Professional Documents
Culture Documents
Manual
004–2138–003
!"#$ &%' ()*+,%-./-. 0'-.1&"2& 34567869*+:* -;<-.7=34>$?*A@8-B<-C6<?15D-.1E FA>4=+? 3G5-./
6-.34 *+*+-.1H@?>E*+;*7I@?>KJL *+*+-CM6-.34 // N?=8O ,9+ "
P NQ 2DR&SE#UTLSV%'R&W2D%'YX&2DRSZ%'Y,[\2D P R&,R TLS
] /-C1 56 ;*+'?D1& / ?+56<-D@?>E* !-B,0'-. 34-C!*\+5@?^Y-.*'*+$<-./*+ *+ U,W-;*8=Y7* _ F* -B% (!*+, FS,*+` 56W-a*b9#$%
cd " dd 9efg9!1&h7D F/ 34 ;\?D+56-;W/?! 56/-. F* -ab9#$%i'7\ 4* !-BSUjUS!S,jkRg7&T`#$W#Gb9#$%EW5&6 -934-C!*+W" ] A5@8 +!-.1L9 ()*+
<-./-.0'-.1`51&-.:* -aX6>8 (* P Jl,7='* - ] *+-;1lO*+*+-./"'XD!*+9*+?9h 34A56=Y* 56<-. ,O E,9 +6 " mnnD#U3$! * -.*+<-
op JH> " Qq5!*+ Lr, -CJ'X#Gfnf;ses c "
#U56*+?*+ p ()'X6b?6X69>W6XD9>M#$1XD9>' ?=+* 6XD9>ut'eYQ o X6>?e/!XD%' =Y73$XD%'Yhv.wix9y<z7{\ 0'D[H/|' P @8O Q oo #U6<-C!*+ -9!OOS'
]$o R&%'X P] /2DR&%i ] TLYXDjU/|'e+Q o R#U61 ] TLYX6jkOh3 p <-H=+-.1&-. >E<-;(? /*+-.<-.1}*+1-C3E p 1}~&-.56/-!!kJL? p W*+*+ F ,
/ !18XDX6 6X6X&Ql2?8X6b?n6X6b2?'XDb2 d 'XDb2D8XDX&569C-C*Qq; *+-C!9!-!2I7? +'X6jk/!XD9>u#U! 34*+ g2&-;;*+-; X6>u# oo XD9>}X6n
XD9>}XD;nS!X6>EXDlXD3$6 (MW>'/*+-C3$X69>'S,?Y6X69>}R P XD9>M/n!XD9>KnW-9'X69> P p !XD9>KTlU/'XD9>'h%'R&R P @899A
XD9>}/e+Q o XD9>EOOSe+2Dn!XD9>E/rH'XD9>K2Dn!X69>u2&sSXD9>K2&sR !XD9>?2O56*+? 'XD9>M|'e+Q o 6X69>u|QN/6X6>?e d !XDO Ql8X&rD2?
SU-. 0'-;9 !($* -D6Jl-.\"A"i" 6S,,56/+S,?Y0' -9J:R QNSU/6, (i%' ()[HR |'#$%iYjU/ATlSO-. -.8TL-;* JL? p SU p #$99>)
TL-;* JL? p !56-C56 !(KR A0 <34-C!* TL-.* JL? p !56-C56 (B2&?76j P TLR 2?8%'k/OR& P SU%i!/Q#$%O2DR ! ]$o R% P Tl{&
/>8/*+-C3QN !*+-C!-k1}%'-934?*-62I-./*+ !(KR A0'<A3E-C* A2I 56/*+-.1 ] TLYXDjU/!9!1 ] Tl+XDjk,Ql#U| ;C-`*+1-934 p :?=8XD9>E%'-;W-;;CYA
P " P " XD" 'JH? >EJH!-.1L+5@8/ 1& >4?=O E,9+6 "
Y%' |1}O E,9 <-H<-.(?W*+-;<-.1}*+91&-C34 p U9!1LO,'!1L* !-HO,'7(?u<-H*+91&-C34 p U7='O ,9 + !"
XDS,XF *+91&-C34 p 7='X6*+<?8SU*+B/>8/*+-C3E6 "SUR&X ]$P 2D%' |'Ar#U|'61`rDQq <-H*+91&-C34 p :?=!S, (i *+R&56 3E-C*
XD767;*+!"'R&%'n` ,a*+91&-C3E; p ?=8R Ql#K /! "R 2?# *+91&-C34 p 7='R2?#W>'/*+-C34+6 !"!Y~Q *+91&-C34 p 7=' !*+-. !*+ !
~ 56/ -;WQqY -.XD767;*+!"QN o ,a*+91&-C3E; p ?=?Qq o X63$56*+-.:W>'/*+-C34/" o 7/*+O 6*' ,`*+91&-C3E; p ?=?#$1&@8-H/>8/*+-C34+
" ] Tl | \`<-;(? /*+-.<-.1}*+1-C3E p F* - ] ! *+-.1 *+*+-.:1}?* -.D5!*+9 -; -C!/-.1-. 56/ 0'-. >E* <56(l|,hj!6-CEXD3K6A>
P 34*+-.1&"|,hj!6-CE <-.(? /*+-.<-;1*+1-934 p ?=?|Uhj!!-9FXD3K6A> P *+1&"&|EN 1&J/>8/*+-C31l* -D| 1-90' -`;C-a*+91&-C3E; p 7=2&-
j!6-C_,<56"
2&- ] TLYX6jku6-.*+ (K+>8/*+-C3 ,1-. 0'-.1=+<3 ] Tl |6g/>'W*+-93r6".2&- ] TLYX6jkH6-.9*+ (g+>8/*+-C3 , /k@8/-.1l g6;*'_* -
bi56* 4~&-. p -. -C>_O7=Y* JL<-aSU /*+9 @?56*+ N+~&OS,A5!1&-.6 -C/-H=Y<32&-B%'-.(?-9*+,7='* - ] 0'-.9/ * >}?=!X6 =+? "
O*+" o -.*+-. ~/ a 34(?-a569*+-.+>4?=8R TLR P /#1l !=+?~ >8*+-B/#$"iS, p 2&!<Jl-.: 34(?-a569*+-;>4?=?|U90'-.D~&-.<-C!(56-. #U 3E*+ "
Record of Revision
\&O&?' &&O)u¡?'
¢\£ ¤ ¥W¦§\¨_©&ªIªI«
¬E;®<¯!® §\°I±² ;® §\³ ® § ¯ £´,µ ®<¶g·,¸¹ ¦ºV¨§\³a§ ¸»¼® § ¹ ±<¦ · ¨ ¶ ³µ\¨_½°&³Wµ ¾ ®<¿! ° ;À)¸ ¦³ ® §\¨ ¶l» µ ®<¹ µV° ¨
¹ °I±<±<¨ · ° ¶g® §\³ ® § ¶O®<¹?¶ °I§ ·® § ¹ ±<¦ · ¨ ¶ ºV°I§ZÁ° ¯ ¨ ¶gÂW¸! Ã!¸! ³ °I§°I§ ·ÅÄÆ® §\³ ® § ¶O®<¹}¶ ¦ ¿ Á )¸¯6 °Iº ¶ £
¢\£ © Ç4¦ ¯ ¦ ¶ ³a©IªIªIÈ
É4Á · °I³W¨ · ³ ¸Z ¨Ê,¨ ¹ ³ ¹ µ\°I§ ¯ ¨ ¶® §Å³µ\¨_² )¸!¯! °IºVº ® § ¯Ë §\Ì ®<)¸ §\ºV¨§\³ ¢D£ © ¨±<¨° ¶ ¨6£,´,µ\¨
Á ;® §\³W¨ · ³W¨Í8³ ¸Â ³µ ®<¶ ºV°I§\¦°I± » ° ¶ ºV° · ¨_°IÌ6° ® ±<° ¿ ±<¨ ® §Å² ¸¶ ³Î ¹i;® Á³HÏ £ Á ¶OÐaÂ/¸ ºV°I³ ÂW¸ ³µ ®<¶
¨±<¨° ¶ ¨!£
¢\£ Ñ ¥W°I§\¦° ;À ©IªIª&ª
É4Á · °I³W¨ · ³ ¸Z ¨Ê,¨ ¹ ³ ¹ µ\°I§ ¯ ¨ ¶® §Å³µ\¨_² )¸!¯! °IºVº ® § ¯Ë §\Ì ®<)¸ §\ºV¨§\³ ¢D£ Ñ ¨±<¨° ¶ ¨6£,´,µ\¨
Á ;® §\³W¨ · ³W¨Í8³ ¸Â ³µ ®<¶ ºV°I§\¦°I± » ° ¶ ºV° · ¨_°IÌ6° ® ±<° ¿ ±<¨ ® §Å² ¸¶ ³Î ¹i;® Á³HÏ £ Á ¶OÐaÂ/¸ ºV°I³ ÂW¸ ³µ ®<¶
¨±<¨° ¶ ¨!£
¤I¤I¢ ¥W¦± À ©IªIª&ª
´,µ ®<¶l ¨Ì ®<¶7®<¸ § ¶ ¦ÁÁ ¸ ³ ¶ ³µ\¨_² )¸!¯! °IºVº ® § ¯Ë §\Ì ®<)¸ §\ºV¨§\³`¢\£ ¢F°I§ · ³Wµ\¨_½ÓÒ/²Î8Á )¸ «D£ ¢
¨±<¨° ¶ ¨ ¶ £,´,µ\¨_ºV°I³µ°IÁ:Á¨§ ·,® Í ¶ ¨ ¹ ³ ®<¸ § ¶ µ\°&ÌD¨ ¿ ¨¨§º ¸ Ì6¨ · ³ ¸ ³µ\¨_Ô!Õ ÖØ×.Ù6ÚWÖ Û ÕlÜ!ÖØÝAÞ;ß?Þ;à
á$â.×;Þã âKäMå!ÖØæI×£´,µ ®<¶l ¨Ì ®<¶O®<¸ § ®<¶ °IÌ6° ® ±<° ¿ ±<¨ ® §Å² ¸¶ ³Î ¹i;® Á³HÏ £ Á ¶OÐaÂ/¸ ºV°I³ £
004–2138–003 i
About This Manual
´,µ <® ¶ ºV°I§\¦°I± ·¸!¹ ¦ºV¨§\³ ¶ ³Wµ\¨ ® §\³ ® § ¶O®<¹ Á )¸¹ ¨ · ¦ ¨ ¶Â/¸ ³µ\¨ ÂW¸ ±<± ¸!»N® § ¯V¹?¸ ºVÁ ® ±<¨ ¶Iç
è ,´ µ\¨_½ÓÒ/²Î8Á )¸ « Ã!¸! ³ °I§ÅªI¤ ¹i¸ ºVÁ ® ±<¨ éD» µ ®<¹ µ ®<¶L ¨±<¨° ¶ ¨ ·Ó»N® ³WµÅ³µ\¨½ÒW²Î'Á )¸
¨±<¨° ¶ ¨ ¶¸ §Ò/êHÒ/ëìÁ±<°I³ ÂW¸! º ¶ £
è ´,µ\¨ ÄK ° ÀZÄ$ÄKííÓ¹?¸ ºVÁ ® ±<¨ é\» µ ®<¹ µ ®<¶} ¨±<¨° ¶ ¨ ·»N® ³WµZ³Wµ\¨_² )¸¯6 °IºVº ® § ¯
Ë §\Ì ®<)¸ §\ºV¨§\³ ¨±<¨° ¶ ¨ ¶4¸ §É4îÒ ÄK¬ Î °I§ · É4îNÒ ÄK¬ Î,ï8ºVðVÁ:±<°I³ ÂW¸ º ¶ £
è ´,µ\¨ ÄKà ªI¤ ¹i¸ ºVÁ ® ±<¨ éD» µ ®<¹ µ ®<¶L ¨±<¨° ¶ ¨ ·Ó»N® ³WµÅ³µ\¨² )¸¯! °&ºVº ® § ¯Ë §\Ì ®<¸ §\ºV¨§\³
¨±<¨° ¶ ¨ ¶¸ §É4îÒ ÄK¬ Îq°I§ · É4îÒ ÄK¬ Îï8ºVðÅÁ:±<°I³ ÂW¸ º ¶ £
´,µ ®<¶} ¨Ì ®<¶7®<¸ § ¶ ¦ÁÁ ¸ ³ ¶ ³µ\¨_½ÓÒ/²Î8Á )¸ «\£ ¢N°I§ · ³µ\¨_² )¸!¯! °IºVº ® § ¯Ë §\Ì ®<)¸ §\ºV¨§\³a¢D£ ¢
¨±<¨° ¶ ¨ ¶ £
´,µ ®<¶}®<¶ ° ¨  ¨ ¨§ ¹ ¨ºV°I§\¦°I± ÂW¸! °IÁÁ± ®<¹ °I³ ®<¸ §Å°I§ ·Ó¶OÀ!¶ ³W¨ºñÁ )¸!¯! °IºVºV¨ ;¶ £kê`¨° · ¨ ;¶
¶ µ ¸ ¦± · °I± ¶O¸ µ\°IÌ6¨F° »N¸ ð ® § ¯ ð!§ ¸!» ±<¨ ·,¯ ¨ ¸Â ¨ ® ³Wµ\¨ ³Wµ\¨_É}îNÒ Ä$¬ Î é É4îNÒ ÄK¬ Î,ï8ºVð é:¸
ÒWê`ÒWë ¸ Á¨ °I³ ® § ¯ ¶7À!¶ ³W¨ºò°I§ · ° »N¸ ð ® § ¯ ð!§ ¸!» ±<¨ ·,¯ ¨ ¸! ³Wµ\¨ Ã!¸! ³ °I§ ¸!MÄ
Á )¸¯! °IºVº ® § ¯ ±<°I§ ¯ ¦° ¯ ¨6£
Related Publications
´,µ\¨ Â/¸ ±<± ¸»N® § ¯·,¸¹ ¦ºV¨§\³ ¶l¹?¸ §\³W° ® §ó° ·,·,® ³ ®<¸ §\°I± ® § Â/¸ ºV°I³ ®<¸ §³µ\°I³HºV° ÀV¿ ¨Fµ\¨±<Á  ¦± ç
è Ô!×9ô\õ}×;Ù6ÚHÜ!ö?ß?æI×;ÞM÷/Ô!ø,äMÜ!ù4úHû`ß?Ù!æNüØæú`× ý7×;Þ×;Ù6Õ×aþß?Ù!å6ß?ü
è á$ÿ }Ôá$â.×;Þ Höiõ}õ4ß?Ù!æIâMú`× ý?×;Þ×;Ù!Õ ×BþßiÙ!å!ßiü
è äMå!ÖØæI×KÚWö ,ßiÞ.ß?üØüØ×;ü ×;ÕÚWöiÞ IüØÖYÕ ß?ÚWÖØö?Ù6â
è á$ÿ }ÔVÔ!àIâ;ÚW×;õÜ6ÖYÝÞ.ßiÞ.ÖØ×;âKú`× ý?×;Þ×;Ù!Õ ×BþßiÙ!å!ßiü
è á$ÿ }ÔVÔ!àIâ;ÚW×; õ `ß?üØüYâMúH× ý?×;Þ×;Ù!Õ ×Bþß?Ù6å!ß?ü
´,µ\¨ Â/¸ ±<± ¸»N® § ¯ ºV°I§\¦°I± ¶·,¸¹ ¦ºV¨§\³B³Wµ\¨ Ä$ ° À ¾ ®<¿!¶ Á )¸· ¦ ¹ ³£kÇ4±<±,ºV°I§ZÁ° ¯ ¨ ¶l® §³µ\¨ ¶ ¨
ºV°I§\¦°&± ¶¹ °I§ó°I± ¶O¸¿ ¨Ì ® ¨ » ¨ ·Ó¸ §\± ® §\¨ ¿!À ¦ ¶O® § ¯ ³Wµ\¨ man ¹?¸ ºVºV°I§ · ç
è IüYÖØÕßiÚWÖØö?Ù ,Þöô\Þ;ß?õ4õ}×;Þã âgÜ6ÖYÝAÞ;ß?Þ;àNúH× ý?×.Þ)×;Ù!Õ ×Bþß?Ù6å!ß?ü
è Ô!Õ ÖØ×.Ù6ÚWÖ Û ÕlÜ!ÖØÝAÞ;ß?Þ;àú`× ý?×;Þ×;Ù!Õ ×BþßiÙ!å!ßiü
ÒW§° ·,·,® ³ ®<¸ §³ ¸ ³µ\¨ ¶ ¨ ·,¸¹ ¦ºV¨§\³ ¶Oé:¶ ¨ÌD¨ °I±UºV°I§\¦°I± ¶l·,¸!¹ ¦ºV¨§\³BÎ Ò ¹i¸ ºVÁ ® ±<¨ ;¶Iç
è `ö?õ4õ}ß?Ù6æIâMß?Ù!æNù4ÖYÞ)×.Õ ÚWÖ I×.âMúH× ý?×.Þ)×.Ù6Õ×`þß?Ù6å!ß?ü
004–2138–003 iii
Intrinsic Procedures Reference Manual
Obtaining Publications
´,µ\¨Zá$â;×.Þ*,å!ÝAüØÖØÕßiÚWÖYöiÙ!â+`ß?ÚWß?üØöô · ¨ ¶O¹?®<¿ ¨ ¶ ³µ\¨N°IÌ6° ® ±<° ¿!® ± ® ³ À °I§ ·Ó¹?¸ §\³¨§\³ ¸! °I±<±
É}îNÒ Ä$¬ ΰI§ · É4îÒ ÄK¬ Îï8ºVðVµ\° )·,» ° ¨N°&§ ·Ó¶O¸! ³ » ° ¨ ·,¸!¹ ¦ºV¨§\³ ¶ ³Wµ\°&³`° ¨
°IÌ6° ® ±<° ¿ ±<¨F³ ¸ ¹ ¦ ¶ ³ ¸ ºV¨ ;¶ £ Ä ¦ ¶ ³ ¸ ºV¨ ;¶L» µ ¸¶ ¦ ¿!¶O¹?®<¿ ¨E³ ¸ ³Wµ\¨ Ä$ ° À ÒW§ Â/¸ º
Ï Ä êHÒ/§ ÂW¸ º Ð Á )¸!¯! °&º ¹ °I§Å° ¹?¹ ¨ ¶O¶ ³µ ®<¶l® § ÂW¸! ºV°I³ ®<¸ § ¸ §³Wµ\¨ Ä êHÒ/§ ÂW¸! º ¶7À!¶ ³W¨º£
´ ¸V¸!)· ¨ ° ·¸!¹ ¦ºV¨§\³ é:¹ °I±<± í -© ,.I-© ,IÈ&-¢ .IªI¤I«D£UÎ ÒH¨ºVÁ± ¸À ¨¨ ¶ ºV° À ¶ ¨§ · ¨0/WºV° ® ±U³ ¸
orderdsk@sgi.com
£
Ä ¦ ¶ ³ ¸ ºV¨ ¶» µ ¸ ¶ ¦ ¿!¶7¹?;®<¿ ¨³ ¸ ³µ\¨ Ä ê`ÒW§ Â/¸ ºñÁ )¸¯! °Iº ¹ °&§ ¸!)· ¨ L¶O¸Â ³ » ° ¨ ¨±<¨° ¶ ¨
Á° ¹ ð!° ¯ ¨ ¶ ¨±<¨ ¹ ³ )¸ § ®<¹ °I±<± ÀV¿!À ¦ ¶7® § ¯ ³µ\¨ Order Cray Software ¸ Á:³ ®<¸ §H£
Ä ¦ ¶ ³ ¸ ºV¨ ¶¸ ¦³ ¶O®<· ¨ ¸Â ³µ\¨NÉ}§ ® ³W¨ · Î'³°I³¨ ¶ °&§ ·ÓÄ °I§\° · ° ¶ µ ¸ ¦± ·¹?¸ §\³W° ¹ ³a³µ\¨ ®< ± ¸¹ °I±
¶ ¨ Ì ®<¹ ¨ ¸)¯ °I§ 2® 1 °I³ ®<¸ § ÂW¸!g¸)· ¨ ;® § ¯ °I§ ·Ó·¸!¹ ¦ºV¨§\³°I³ ®<¸ § ® § ÂW¸ ºV°&³ ®<¸ §H£
Conventions
´,µ\¨ / ¸ ±<± ¸»N® § ¯¹?¸ §\ÌD¨§\³ ®<¸ § ¶ ° ¨¦ ¶ ¨ · ³µ )¸ ¦ ¯ µ ¸ ¦³ ³µ ®<¶l·,¸¹ ¦ºV¨§\³ ç
Ä ¸ § Ì ¨ § ³®¸ § ½ ¨ ° § ®§ ¯
´,µ ®<4¶ 3 Í8¨ · / ¶ Á° ¹ ¨ ÂW¸ §\³ · ¨§ ¸ ³¨ ¶ ± ® ³¨ °I± ® ³¨º ¶L¶ ¦ ¹ µÅ° ¶
command ¹?¸ ºVºV°&§ ·,¶Oé53 ±<¨ ¶7é\)¸ ¦³ ® §\¨ ¶Oé Á°I³µÅ§\°IºV¨ ¶7é:¶7®<¯ §\°I± ¶Oé
ºV¨ ¶O¶ ° ¯ ¨ ¶Oé °I§ · Á )¸!¯! °IºVº ® § ¯ ±<°I§ ¯ ¦° ¯ ¨ ¶ ³ ¦ ¹ ³¦ ¨ ¶ £
Iß?Þ;ÖYßiÝAüY× Ò/³°I± ®<¹ ³ À Á¨  ° ¹ ¨ · ¨§ ¸ ³W¨ ¶ Ì6° ;® ° ¿ ±<¨F¨§\³ ;® ¨ ¶ °&§ ·Ó»N¸!)·,¶
¸g¹?¸ § ¹ ¨Á³ ¶L¿ ¨ ® § ¯· ¨ 3 §\¨ · £
iv 004–2138–003
About This Manual
´,µ ®<¶l¿!¸ ± ·,é53 Í8¨ · / ¶ Á° ¹ ¨ Â/¸ §\³ · ¨§ ¸ ³¨ ¶ ± ® ³W¨ °I± ® ³¨º ¶
user input
³µ\°I³H³Wµ\¨_¦ ¶ ¨ ¨§\³¨ ;¶l® § ® §\³¨ ° ¹ ³ ® Ì6¨ ¶ ¨ ¶O¶7®<¸ § ¶ £
¬ ¦³WÁ¦³ ®<¶L¶ µ ¸» § ® §Å§ ¸ § ¿!¸ ± ·,é"3 ͨ · / ¶ Á° ¹ ¨ ÂW¸ §\³£
Ë êHê ¬ ê`Î 6}¸!¹ ¦ºV¨§D³ ¶ ¨ )¸L¹?¸· ¨ ¶ £UÇ}ÁÁ± ® ¨ ¶L¸ §\± À ³ ¸V¶OÀ6¶ ³¨º
¹ °I±<± ¶ £
Ã!¬ Uê ´,ê`Ç}î 6 ¨ ¶O¹?®<¿ ¨ ¶ µ ¸!» ³ ¸ ¹ °&±<±U° ¶OÀ6¶ ³W¨º ¹ °I±<± ÂW)¸ º Ã!¸! ³ °I§H£
Ë ëH´ Ë îNÎ8Ò ¬ îNÎ Ç4Á:Á± ® ¨ ¶¸ §\± À ³ ¸Z¶OÀ!¶ ³W¨º ¹ °&±<± ¶ £
;,É Î Ò/§ ·®<¹ °&³W¨ ¶ ð!§ ¸!» § ¿ ¦ ¯!¶ °I§ ·Ó· ¨ 3¹i® ¨§ ¹i® ¨ ¶ £
Ë ëHÇ4½Ó²¾ Ë Î Î8µ ¸!»N¶ ¨Í°IºVÁ±<¨ ¶¸Â ¦ ¶ ° ¯ ¨6£
à Ò/¾ Ë Î ¾ ®<¶ ³ 4¶ 3 ±<¨ ¶ ³µ\°I³B° ¨¨ ® ³Wµ\¨ Á:° ³ ¸Â ³µ\¨_¨§\³ ÀV¸! ° ¨
¨±<°&³W¨ · ³ ¸ ® ³ £
Î Ë,Ë Ç}¾,Î ¬ ¾ ®<¶ ³ ¶ ¨§\³ ® ¨ ¶ °I§ · Á¦ ¿ ± ®<¹ °&³ ®<¸ § ¶ ³µ\°I³ ¹?¸ §\³W° ® § ¨±<°I³W¨ ·
® § ÂW¸! ºV°I³ ®<¸ §H£
Reader Comments
Ò Â À!¸ ¦µ\°&ÌD¨ ¹i¸ ºVºV¨§\³ ¶ ° ¿6¸ ¦³H³Wµ\¨_³¨ ¹ µ\§ ®<¹ °I±B° ¹?¹ ¦ ° ¹iÀOé¹?¸ §\³¨§\³ éD¸!M¸!)¯ °I§ ®21 °I³ ®<¸ § ¸Â
³µ ®<¶4·¸!¹ ¦ºV¨§\³ é Á:±<¨° ¶ ¨F³W¨±<±U¦ ¶ £>;,¨ ¶ ¦ ¨³ ¸V® § ¹ ±<¦ · ¨E³µ\¨N³ ® ³W±<¨F°&§ · Á° ³a§\¦º ¿ ¨ M¸!Â
³µ\¨ ·¸!¹ ¦ºV¨§\³ »N® ³Wµ À!¸ ¦ M¹?¸ ºVºV¨§\³ ¶ £
7 ¸ ¦ ¹ °I§ ¹?¸ §\³° ¹ ³a¦ ¶}® §Å°I§ À¸Â ³µ\¨ Â/¸ ±<± ¸»N® § ¯» ° À!¶Iç
è Î8¨§ · 0¨ /WºV° ® ±U³ ¸ ³µ\¨ ÂW¸ ±<± ¸»N® § ¯ ° ·,·, ¨ ¶O¶Iç
techpubs@sgi.com
è Î8¨§ · °  °Iͳ ¸ ³µ\¨°I³W³¨§\³ ®<¸ § ¸Â? ´¨ ¹ µ\§ ®<¹ °&±k²¦ ¿ ± ®<¹ °&³ ®<¸ § ¶A@ °I³ ,ç í © ,B.I¤NªI¢IѤIÈI¤I©\£
è É ¶ ¨E³Wµ\¨ à ¨¨ ·,¿ ° ¹ ð ¸ Á³ ®<¸ § ¸ §³µ\¨_´¨ ¹ µ\§ ®<¹ °I±U²¦ ¿ ± ®<¹ °I³ ®<¸ § ¶ ¾ ®<¿6 ° ; À 8 ¸ ± · 8 ®<· ¨
8 ¨ ¿ Á:° ¯ ¨ ç
http://techpubs.sgi.com
è Ä &° ±<±U³Wµ\¨_´8¨ ¹ µ\§ ®<¹ °&±k²¦ ¿ ± ®<¹ °&³ ®<¸ § ¶ )¸ ¦Á é ³µ )¸ ¦ ¯ µÅ³Wµ\¨´¨ ¹ µ\§ ®<¹ °I±UÇ ¶O¶O®<¶ ³W°I§ ¹ ¨
Ä ¨§\³W¨ é ¦ ¶O® § ¯¸ §\¨ ¸! ³Wµ\¨ ÂW¸ ±<± ¸!»N® § ¯ §\¦º ¿ ¨ ;¶ç
Ã!¸! CÎ ÒHÒWê`ÒWë ¿ ° ¶ ¨ ·¸ Á¨ °I³ ® § ¯ ¶7À!¶ ³W¨º ¶ç ©ÈI¤I¤ÈI¤I¤EDIÎÒ
Ã!¸! É4îNÒ ÄK¬ Î ¸ É}îNÒ Ä$¬ Îï8ºVð ¿ ° ¶ ¨ ·¸ Á¨ °I³ ® § ¯V¶OÀ!¶ ³¨º ¶¸gÄK ° À ¬E;®<¯!® §óÑI¤I¤I¤
¶OÀ6¶ ³¨º ¶Iç ©È&¤I¤Nª .I¤ÑI«IÑIªNÏW³ ¸ ±<± Â/ ¨¨ ÂW)¸ º ³µ\¨_É4§ ® ³¨ · Î8³°I³W¨ ¶ °I§ ·Ä °&§\° · ° ÐB¸!
í © ,.I© ,IÈI-¢ .,&¤I¤
è Î8¨§ · ºV° ® ±,³ ¸ ³µ\¨ ÂW¸ ±<± ¸!»N® § ¯ ° ·,·, ¨ ¶7¶Iç
´I¨ ¹ µ\§ ®<¹ °&±k²¦ ¿ ± ®<¹ °&³ ®<¸ § ¶
Î Ò
© ,I¤&¤qÇ}ºVÁµ ® ³Wµ\¨°I³ ¨_²ð »NÀ £
vi 004–2138–003
About This Manual
004–2138–003 vii
CONTENTS
NAME
ABS, DABS, QABS, IABS, IIABS, JIABS, KIABS, CABS, CQABS, CDABS – Computes absolute value
SYNOPSIS
ABS ([A=]a)
DABS ([A=]a)
QABS ([A=]a)
IABS ([A=]a)
IIABS ([A=]a)
JIABS ([A=]a)
KIABS ([A=]a)
CABS ([A=]a)
CDABS ([A=]a)
CQABS ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QABS, IIABS, JIABS, KIABS, CQABS, CDABS
DESCRIPTION
ABS is the generic function name; the others are specifics. These are elemental intrinsic functions. They
accept the following arguments:
x Must be a numeric data type (real, complex, or integer) of any supported kind type. See the
RETURN VALUES section for more information on input data types and return values.
These functions evaluate as follows: y = x , except for CABS and CDABS, which evaluate the following:
2 2 1/2
y = (x r + x i )
NOTES
The ABS, IABS, DABS, and CABS intrinsic function names can be passed as arguments; the others cannot.
On Cray T90 systems that support IEEE arithmetic, the following return values occur:
ABS(x):
• If x = infinity, the result is infinity.
• If x = NaN, the result is NaN.
CABS(x):
• If x or y = NaN, the result is NaN.
• If x = infinity and y is not NaN, the result is infinity.
• If y = infinity and x is not NaN, the result is infinity.
RETURN VALUES
ABS returns the absolute value of its argument. The data type of the result is the same as the data type of a
except that if input argument a is type complex, the result is type real.
DABS returns the double-precision absolute value of its double-precision argument.
QABS returns the quad-precision absolute value of its quad-precision argument.
IABS returns the integer absolute value of its integer argument.
IIABS returns the integer (KIND=2) absolute value of its integer (KIND=2) argument.
JIABS returns the integer (KIND=4) absolute value of its integer (KIND=4) argument.
KIABS returns the integer (KIND=8) absolute value of its integer (KIND=8) argument.
CABS returns the absolute value of its single-precision complex argument as a single-precision real number.
CDABS returns the absolute value of its complex double-precision argument as a double-precision real
number.
CQABS returns the absolute value of its complex quad-precision argument as a quad-precision real number.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
NAME
ACOS, DACOS, QACOS, ACOSD, DACOSD, QACOSD – Computes arc cosine (inverse cosine)
SYNOPSIS
ACOS ([X=]x)
DACOS ([X=]x)
QACOS ([X=]x)
ACOSD ([X=]x)
DACOSD ([X=]x)
QACOSD ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QACOS, ACOSD, DACOSD, QACOSD
DESCRIPTION
ACOS, DACOS, and QACOS return the arc cosine in radians. ACOSD, DACOSD, and QACOSD return the arc
cosine in degrees. ACOS and ACOSD are generic function names; the others are specifics. These are
elemental intrinsic functions. These routines accept the following argument:
x Must be of type single precision, double precision, or quad precision. The type and kind type of
x is identical to the type and kind type of the return value. The absolute value of the arguments
for ACOS, DACOS, QACOS, ACOSD, DACOSD, and QACOSD must be ≤ 1. See the RETURN
VALUES section for information on input data types and return values.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
For ACOS, DACOS, and QACOS, the result is in radians and is in the range 0 ≤ result ≤ pi. The generic
form, ACOS, can be used for all real data types because it derives its type and kind type from that of its
argument.
For ACOSD, DACOSD, and QACOSD, the result is in degrees and is in the range 0 ≤ result ≤ 180. The
generic form, ACOSD, can be used for all real data types because it derives its type and kind type from that
of its argument.
Vector versions of these intrinsics exist on some systems. Vector versions of ACOS and DACOS exist on
UNICOS and UNICOS/mk systems. On UNICOS/mk systems, the vector versions of these intrinsics are
used when -O vector3 or -O3 has been specified on the compiler command line. On UNICOS/mk
systems, the 64-bit intrinsic vectorizes; the 32-bit version does not. A vector version of the single-precision
and double-precision ACOS intrinsic exists on IRIX systems and is used when -O3 is specified on the
compiler command line.
These functions evaluate y = arccos(x).
NOTES
The ACOS and DACOS intrinsic function names can be passed as arguments; the others cannot.
On Cray T90 systems that support IEEE arithmetic, if x > 1.0 or if x = NaN, the result is NaN.
RETURN VALUES
ACOS and ACOSD return the real arc cosine of their real arguments.
DACOS and DACOSD return the double-precision arc cosine of their double-precision arguments.
QACOS and QACOSD return the quad-precision arc cosine of their quad-precision arguments.
SEE ALSO
intro_intrin(3I)
NAME
ADJUSTL – Adjusts a character string to the left
SYNOPSIS
ADJUSTL ([STRING=]string)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The ADJUSTL intrinsic function adjusts a character string to the left, removes leading blanks, and inserts
trailing blanks. It accepts the following argument:
string Must be of type character
ADJUSTL is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is type character with the same length as string.
The value of the result is the same as string, except that any leading blanks have been deleted and the same
number of trailing blanks have been inserted.
EXAMPLES
In the following examples, a carat (^) indicates a blank.
Example 1:
CHARAC TER*6 VAR
VAR = ADJUST L( ’^^ WOR D’ )
PRINT *,"VAR =’" , VAR ,"’"
Example 2:
CHA RAC TER*29 STR ING
STRING = ’^^^TEST STR ING FOR ADJ UST L^^ ^’
WRI TE(6,1 ) ’>’ , STR ING , ’<’
WRI TE( 6,1) ’>’, ADJUST L(STRI NG), ’<’
1 FOR MAT (3A)
END
NAME
ADJUSTR – Adjusts a character string to the right
SYNOPSIS
ADJUSTR ([STRING=]string)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The ADJUSTR intrinsic function adjusts a character string to the right, removes trailing blanks, and inserts
leading blanks. It accepts the following argument:
string Must be of type character
ADJUSTR is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is type character with the same length as string.
The value of the result is the same as string except that any trailing blanks have been deleted and the same
number of leading blanks have been inserted.
EXAMPLES
In the following examples, a carat (^) indicates a blank.
Example 1:
VAR = ADJUST R( ’WO RD^ ^’ )
PRINT *,"VAR =’" , VAR ,"’ "
This code segment returns the following output:
VAR=’^ ^WORD’
Example 2:
CHA RAC TER*29 STR ING
STRING = ’^^^TEST STR ING FOR ADJ UST R^^ ^’
WRI TE( 6,1) ’>’, STRING ,’<’
WRI TE(6,1 ) ’>’ , ADJ UST R(S TRI NG) , ’<’
1 FOR MAT(3A )
END
NAME
AIMAG, IMAG, DIMAG, QIMAG – Returns imaginary part of a complex number
SYNOPSIS
AIMAG ([Z=]z)
IMAG ([Z=]z)
DIMAG ([Z=]z)
QIMAG ([Z=]z)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: IMAG, DIMAG, QIMAG
DESCRIPTION
AIMAG, IMAG, DIMAG, and QIMAG return the imaginary part of a complex number. AIMAG is the generic
function name; the others are specifics. These are elemental intrinsic functions. IMAG is a nonstandard
intrinsic elemental function and is a synonym for AIMAG. These functions accept the following argument:
x Must be of type single-precision complex, double-precision complex, or quad-precision complex.
See the RETURN VALUES section for information on input data types and return values.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
These functions evaluate y = x i , where z = x r ,x i .
NOTES
The AIMAG intrinsic function name can be passed as an argument; the others cannot.
RETURN VALUES
AIMAG and IMAG return the imaginary part of their complex arguments.
DIMAG returns the double-precision imaginary part of its double-precision complex argument.
QIMAG returns the quad-precision imaginary part of its quad-precision complex argument.
EXAMPLES
The following program gives the imaginary part of the complex number (1.0,2.0). After running the
program, RESULT = 2.0.
PROGRAM AIMTES T
REAL RESULT
RESULT =AI MAG( (1.0,2 .0) )
PRINT *, RES ULT
STOP
END
NAME
AINT, DINT, QINT – Performs truncation to integer
SYNOPSIS
AINT ([A=]a[,[KIND=]kind])
DINT ([A=]a)
QINT ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QINT
DESCRIPTION
AINT is the generic function name; the others are specifics. These are elemental intrinsic functions. They
accept the following arguments:
a Specify a single-precision, double-precision, or quad-precision argument.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
kind An integer scalar value. Must be a kind type allowed for a. This argument is not accepted by
the MIPSpro Fortran 77 compiler.
These functions truncate the fractional parts of their arguments, and the fractional parts are lost (not
rounded).
NOTES
The AINT and DINT intrinsic function names can be passed as arguments; the other cannot.
RETURN VALUES
The return values are of type real and have a kind type as specified by the kind argument, if present. If kind
is unspecified, the kind type is that of a.
EXAMPLES
The following examples show the results of calling AINT with positive and negative arguments:
• AINT(3.4) yields 3.0.
• AINT(-3.4) yields -3.0.
NAME
ALL – Determines whether all values are true
SYNOPSIS
ALL ([MASK=]mask [,[DIM=]dim])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The ALL intrinsic function determines whether all values are true in mask along dimension dim. It accepts
the following arguments:
mask Must be of type logical. It must not be a scalar.
dim Must be a scalar. It must be an integer value in the range 1 ≤ dim ≤ n, where n is the rank of
mask. The corresponding actual argument must not be an optional dummy argument.
ALL is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is type logical. It is a scalar result if dim is absent or if mask has rank one. Otherwise, the result
is an array of rank n– 1 and of shape (d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ), where (d 1 , d 2 , . . ., d n ) is the shape
of mask.
The result of ALL(mask) has the value TRUE if all the elements of mask are TRUE or if mask is a
zero-sized array. The result has the value FALSE if any element of mask is FALSE.
If mask has rank one, ALL(mask, dim) has a value equal to that of ALL(mask). Otherwise, the value of
element (s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ) of ALL(mask, dim) is equal to
ALL(mask (s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )).
EXAMPLES
Example 1: ALL((/.TRUE.,.FALSE.,.TRUE./)) yields .FALSE..
Example 2: ALL(array) yields .TRUE. when array is a zero-sized array.
NAME
ALLOCATED – Returns the array allocation status
SYNOPSIS
ALLOCATED ([ARRAY=]array)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The ALLOCATED intrinsic function indicates whether or not an allocatable array is currently allocated. It
accepts the following argument:
array Must be an allocatable array
ALLOCATED is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type, type parameter, and shape are default logical scalar. The result has the value .TRUE. if
array is currently allocated and has the value .FALSE. if array is not currently allocated.
The result is undefined if the allocation status of the array is undefined. See section 6 of the Fortran
Language Reference Manual, Volume 1, for information on the allocation of allocatable arrays.
SEE ALSO
Fortran Language Reference Manual, Volume 1
NAME
AND – Computes logical product
SYNOPSIS
AND ([I=]i,[J=]j)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extension
DESCRIPTION
AND is an elemental function. It accepts the following arguments:
i Must be of type Boolean, integer, real, Cray pointer, or logical.
j Must be of type Boolean, integer, real, Cray pointer, or logical.
NOTES
AND is an outmoded routine. Refer to the Fortran Language Reference Manual, Volume 3, for information
about outmoded features and their preferred standard alternatives. The name of this intrinsic cannot be
passed as an argument.
CAUTIONS
Unexpected results can occur when Boolean functions are declared external and then used with logical
arguments. The external Boolean functions always treat their arguments as type Boolean and return a
Boolean result on UNICOS and UNICOS/mk systems. On IRIX systems, they return an integer result.
RETURN VALUES
When given two arguments of type logical, AND computes a logical product and returns a logical result.
When given two arguments of type Boolean, integer, real, or pointer, AND computes a bit-wise logical
product and returns a Boolean result (on UNICOS and UNICOS/mk systems) or an integer result (on IRIX
systems).
The following tables show both the logical product and bit-wise logical product:
T T T
T F F
F T F
F F F
1 1 1
1 0 0
0 1 0
0 0 0
EXAMPLES
The following section of Fortran code shows the AND function used with two arguments of type logical:
LOG ICAL L1, L2, L3
...
L3 = AND(L1 ,L2 )
The following section of Fortran code shows the AND function used with two arguments of type integer.
The bit patterns of the arguments and result are also given. For clarity, only the rightmost 8 bits are shown.
INT EGER I1, I2, I3
I1 = 12
I2 = 10
...
I3 = AND(I1 ,I2 )
------ ------ --- --- --- --- --- --- - --- --- --- --- --- --- --- --- --- ----
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 |
------ ------ --- --- --- --- --- --- - --- --- --- --- --- --- --- --- --- ----
I1 I2
--- --- --- --- --- --- --- --- --- --- -
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
--- ------ --- --- --- --- --- --- --- -
I3
NAME
ANINT, DNINT, QNINT – Finds nearest whole number
SYNOPSIS
ANINT ([A=]a [,[KIND=]kind])
DNINT ([A=]a)
QNINT ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QNINT
DESCRIPTION
ANINT is the generic function name; the others are specifics. These are elemental intrinsic functions. They
accept the following arguments:
a Must be type single-precision real, double-precision real, or quad-precision real. See the
RETURN VALUES section for information on input data types and return values.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
kind Must be a kind type allowed for a. This argument is not accepted by the MIPSpro Fortran 77
compiler.
NOTES
The ANINT and DNINT intrinsic function names can be passed as arguments; the other cannot.
RETURN VALUES
ANINT returns the real nearest whole number for its real argument, as follows:
• If a ≥ 0, the result is REAL(INT(a + 0.5)).
• If a < 0, the result is REAL(INT(a - 0.5)).
DNINT returns the double-precision nearest whole number for its double-precision argument.
QNINT returns the quad-precision nearest whole number for its quad-precision argument.
EXAMPLES
The following examples show the results of calling ANINT with positive and negative arguments:
• ANINT(3.7) yields 4.0.
• ANINT(-3.7) yields -4.0.
SEE ALSO
AINT(3I)
NAME
ANY – Determines whether any values are true
SYNOPSIS
ANY ([MASK=]mask [,[DIM=]dim])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The ANY intrinsic function determines whether any value is true in argument mask along dimension dim. It
accepts the following arguments:
mask Must be of type logical. It must not be a scalar.
dim Must be a scalar. It must be an integer value in the range 1 ≤ dim ≤ n, where n is the rank of
mask. The corresponding actual argument must not be an optional dummy argument.
ANY is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is type logical. It is a scalar result if dim is absent or if mask has rank one. Otherwise, the result
is an array of rank n– 1 and of shape (d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ), where (d 1 , d 2 , . . ., d n ) is the shape
of mask.
The result of ANY(mask) has the value TRUE if any element of mask is true. The result has the value
FALSE if no elements of mask are true or if mask is a zero-sized array.
If mask has rank one, ANY(mask,dim) has a value equal to that of ANY(mask). Otherwise, the value of
element (s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ) of ANY(mask,dim) is equal to
ANY(mask (s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )).
EXAMPLES
Example 1:
• ANY((/.TRUE.,.FALSE.,.TRUE./)) yields .TRUE..
• ANY(mask) yields .FALSE. when mask is a zero-sized array.
NAME
ASIN, DASIN, QASIN, ASIND, DASIND, QASIND – Computes arc sine (inverse sine)
SYNOPSIS
ASIN ([X=]x)
DASIN ([X=]x)
QASIN ([X=]x)
ASIND ([X=]x)
DASIND ([X=]x)
QASIND ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QASIN, ASIND, DASIND, QASIND
DESCRIPTION
ASIN, DASIN, and QASIN return the arc sine in radians. ASIND, DASIND, and QASIND return the arc
sine in degrees.
ASIN and ASIND are generic function names; the others are specifics. These are elemental intrinsic
functions. They accept the following argument:
x Must be type real. The type and kind type of x is identical to the type and kind type of the
return value. The absolute value of x must be ≤ 1. See the RETURN VALUES section for
information on input data types and return values.
Vector versions of these intrinsics exist on some systems. Vector versions of ASIN and DASIN exist on
UNICOS and UNICOS/mk systems. On UNICOS/mk systems, the vector versions of these intrinsics are
used when -O vector3 or -O3 have been specified on the compiler command line. On UNICOS/mk
systems, the 64-bit intrinsic vectorizes; the 32-bit version does not. A vector version of the single-precision
and double-precision ASIN intrinsic exists on IRIX systems and is used when -O3 is specified on the
compiler command line.
These functions evaluate y = arcsin(x).
NOTES
The ASIN and DASIN intrinsic function names can be passed as arguments; the others cannot.
On Cray T90 systems that support IEEE arithmetic, if x > 1.0 or x = NaN, ASIN(x) yields NaN.
RETURN VALUES
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
For ASIN, DASIN, and QASIN, the result is in radians and is in the range -pi/2 ≤ result ≤ pi/2. For
ASIND, DASIND, and QASIND, the result is in degrees and is in the range -90 ≤ result ≤ 90.
ASIN and ASIND return the real arc sine of their real arguments.
DASIN and DASIND return the double-precision arc sine of their double-precision arguments.
QASIN and QASIND return the quad-precision arc sine of their quad-precision arguments.
NAME
ASSOCIATED – Returns the pointer association status
SYNOPSIS
ASSOCIATED ([POINTER=]pointer [,[TARGET=]target])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The ASSOCIATED intrinsic function returns the association status of its pointer argument or indicates the
pointer is associated with the target. It accepts the following arguments:
pointer Must be a pointer and can be of any type. Its pointer association status must not be undefined.
target Must be a pointer or target. If it is a pointer, its pointer association status must not be
undefined.
ASSOCIATED is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is of type default logical.
If target is absent, the result is true if pointer is currently associated with a target and false if it is not.
If target is present and is a target, the result is true if pointer is currently associated with target and false if
it is not.
If target is present and is a pointer, the result is true if both pointer and target are currently associated with
the same target, and is false otherwise.
If either pointer or target is disassociated, the result is false.
If pointer and target are both dummy arguments, the result is undefined.
EXAMPLES
Example 1: ASSOCIATED(CURRENT,HEAD) yields true if CURRENT points to the target HEAD.
After the preceding statement is executed, the statement ASSOCIATED(A_PART,A) yields true if N is
equal to UBOUND(A,DIM=1).
Example 3: After the execution of the following statements, ASSOCIATED(CUR,TOP) yields false:
NULLIFY(C UR) ; NUL LIFY(T OP)
NAME
ATAN2, DATAN2, QATAN2, ATAN2D, DATAN2D, QATAN2D – Computes arc tangent (inverse tangent) for
two arguments
SYNOPSIS
ATAN2 ([Y=]y,[X=]x)
DATAN2 ([Y=]y,[X=]x)
QATAN2 ([Y=]y,[X=]x)
ATAN2D ([Y=]y,[X=]x)
DATAN2D ([Y=]y,[X=]x)
QATAN2D ([Y=]y,[X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QATAN2, ATAN2D, DATAN2D, QATAN2D
DESCRIPTION
ATAN2, DATAN2, and QATAN2 return the arc tangent, for two arguments, in radians. ATAN2D, DATAN2D,
and QATAN2D return the arc tangent, for two arguments, in degrees. These intrinsics accept the following
arguments:
y Must be type real. For DATAN2 and DATAN2D, must be of type double precision. For
QATAN2 and QATAN2D, must be of type quad precision. See the RETURN VALUES section
for information on input data types and return values.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
For ATAN2, DATAN2, and QATAN2, the following rules apply:
• If y is positive, the result is positive.
• If y is negative, the result is negative.
• If y is positive or negative zero, and if x is positive, the result is positive or negative zero.
• If y is positive or negative zero, and if x is negative, the result is positive or negative pi.
• If y is zero, x cannot also be zero.
NOTES
The ATAN2 and DATAN2 intrinsic function names can be passed as arguments; the others cannot.
RETURN VALUES
ATAN2 and ATAN2D return the real arc tangent of the quotient of their real arguments.
DATAN2 and DATAN2D return the double-precision arc tangent of the quotient of their double-precision
arguments.
QATAN2 and QATAN2D return the quad-precision arc tangent of the quotient of their quad-precision
arguments.
NAME
ATAN, DATAN, QATAN, ATAND, DATAND, QATAND – Computes arctangent (inverse tangent) for single
argument
SYNOPSIS
ATAN ([X=]x)
DATAN ([X=]x)
QATAN ([X=]x)
ATAND ([X=]x)
DATAND ([X=]x)
QATAND ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QATAN, ATAND, DATAND, QATAND
DESCRIPTION
ATAN, DATAN, and QATAN return the arc tangent in radians. ATAND, DATAND, and QATAND return the arc
tangent in degrees.
ATAN and ATAND are generic function names; the others are specifics. These are elemental intrinsic
functions. They accept the following argument:
x Must be type real. The type and kind type of x is identical to the type and kind type of the
return value. See the RETURN VALUES section for information on input data types and return
values.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
These functions evaluate y = arctan(x).
The result range for ATAN, DATAN, and QATAN is -pi/2 ≤ ATAN(x) ≤ pi/2.
The result range for ATAND, DATAND, and QATAND is -90 ≤ result ≤ 90.
Vector versions of these intrinsics exist on some systems. Vector versions of ATAN and DATAN exist on
UNICOS and UNICOS/mk systems. On UNICOS/mk systems, the vector versions of these intrinsics are
used when -O vector3 or -O3 have been specified on the compiler command line. On UNICOS/mk
systems, the 64-bit intrinsic vectorizes; the 32-bit version does not. A vector version of the single-precision
and double-precision ATAN intrinsic exists on IRIX systems and is used when -O3 is specified on the
compiler command line.
NOTES
The ATAN and DATAN intrinsic function names can be passed as arguments; the others cannot.
On Cray T90 systems that support IEEE arithmetic, the following return values occur:
• ATAN(NaN) yields NaN.
• ATAN(infinity) yields pi/2.
• ATAN(-infinity) yields -pi/2.
RETURN VALUES
ATAN and ATAND return the real arc tangent of their real arguments.
DATAN and DATAND return the double-precision arc tangent of their double-precision arguments.
QATAN and QATAND return the quad-precision arc tangent of their quad-precision arguments.
NAME
BIT_SIZE – Returns the number of bits in an integer in the bit manipulation model
SYNOPSIS
BIT_SIZE ([I=]i)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The BIT_SIZE intrinsic function returns the number of bits s as defined by the bit model. The bit model is
described in the MODELS(3I) man page. This intrinsic function accepts the following argument:
i Must be of type integer
BIT_SIZE is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a scalar integer with the same kind type parameter as i.
The result has the value of the number of bits s in the model integer defined in the DESCRIPTION section
of this man page.
EXAMPLES
The following code fragment is run on several systems:
INTEGE R(KIND =1) I1
INTEGE R(KIND =2) I2
INTEGE R(KIND =4) I4
INTEGE R(KIND =8) I8
INTEGE R ID
PRINT *,’BIT _SI ZE I1= ’,B IT_ SIZ E(I 1)
PRINT *,’BIT _SI ZE I2= ’,BIT_ SIZ E(I 2)
PRINT *,’BIT _SI ZE I4= ’,B IT_ SIZ E(I 4)
PRINT *,’BIT _SI ZE I8= ’,BIT_ SIZ E(I 8)
PRINT *,’BIT _SI ZE ID= ’,B IT_ SIZ E(I D)
END
SEE ALSO
MODELS(3I)
NAME
_mclr, _mld, _mmx, _mldmx, _mul, M@CLR, M@LD, M@MX, M@LDMX, M@UL – Performs bit matrix
multiply operations
SYNOPSIS
C/C++:
#include <intrinsics.h>
void _mclr (void);
long _mld (long x2);
long _mmx (long x1);
long _mldmx (long x1, long x2);
long _mul (void);
Fortran:
M@CLR ()
M@LD ([X=]x)
M@LDMX ([X=]x, [Y=]y)
M@MX ([X=]x, [Y=]y])
M@UL ()
IMPLEMENTATION
UNICOS and UNICOS/mk systems
Cray C/C++, CF90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
The Bit Matrix Multiply (BMM) hardware functional unit is standard on all Cray T90 and CRAY SV1
systems. This hardware is available as an option on Cray C90 systems. It can be used to perform very fast
matrix multiply operations of two bit matrixes.
You can use the target(1) command to determine if your system has a BMM functional unit. For systems
without BMM functional units, these intrinsic functions are simulated; however, the presence of BMM
hardware enhances performance.
Because the BMM intrinsic functions generally map directly onto the hardware, there are additional
restrictions placed on their use beyond language conventions, and some additional care must be taken when
writing code that uses them. Most BMM functions must be vectorized in order to generate correct code.
A vector version of this intrinsic exists on UNICOS and UNICOS/mk systems. On UNICOS/mk systems,
the vector version of this intrinsic is used when -h vector3 (C compiler) or -O vector3 or -O3
(Fortran compiler) has been specified on the compiler command line.
The following sections describe the individual routines in more detail for C/C++ and Fortran.
NOTES
C/C++
Operations on square bit matrices in which the number of elements is an integral of 64, can be performed
using the _mldmx instruction to do both the load and multiply. The _mld function allows loading the x2
argument separately for operations on nonsquare matrices of more than 64 elements. Arguments to the bit
matrix multiply functions must be of type long.
Because _mclr, _mld, _mmx, _mldmx, and _mul are intrinsic functions, no externally visible library
functions are available for them. The compiler generates inline code to produce the result.
The following is a summary of the BMM functions:
• _mld - Load transposed bit matrix
_mld loads the BMM functional unit with a matrix vector in transposed form. The function must appear
in an unconditional vector loop and be detectable by the compiler as a short loop. If this intrinsic
function appears in a conditionally vectorized loop or a nonvectorized loop, a fatal error will be issued.
The shortloop directive may be used to indicate a safe condition.
_mld returns a pseudo results, which should not be used because its contents are undetermined. If
multiple references to _mld are made within a single loop, different names must be used to receive the
pseudo result. This requirement forces optimization to consider earlier calls to _mld because the array
that appears to receive the pseudo result seems to have no uses until it is redefined.
• _mmx - Performs bit matrix multiply
_mmx performs the BMM of x1 times x2 transposed. The argument to _mmx is the x1 argument. The
matrix contained in the function unit from a previous _mld, _mmx, or _mldmx invocation is the x2
matrix that is used with x1 to form the result. _mmx may appear in a scalar context and, in that case,
may have a scalar argument.
• _mldmx - Combines the load and multiply functions
_mldmx combines the load and multiply functions. The second argument of _mldmx, x2, is loaded into
the bit matrix function unit prior to the multiply. Matrix x2 is then multiplied by matrix x1. This
intrinsic must appear in a vector loop, as shown in the following example:
CONVENTIONS
Because the BMM functional unit has a memory, you should be aware of the conventions needed to manage
it. The UNICOS operating system maintains the BMM functional unit’s memory when disconnecting and
connecting users from CPUs. The compiler does not guarantee that the data in the unit is maintained across
function or subroutine calls, although it generally is if no other functions or subroutines use the unit. To
preserve the contents of the BMM functional unit across function or subroutine calls, the only completely
safe method is to unload and save the contents with the _mul or M@UL intrinsic and restore the contents of
the functional units before an intrinsic is used.
EXAMPLES
C/C++ examples:
In the following examples, the b matrix is loaded into the function unit where it is stored in its transposed
form. That is, the rows and columns are exchanged: column 1 becomes row 1, column 2 becomes row 2,
and so on. Transposing the input operand b allows the result matrix c to be formed as the mod-2 inner
product of rows a with rows of b. This is done by ANDing the corresponding elements and using the result
of an EXCLUSIVE OR on all the resulting bits.
Example 1:
for (i= 0; i<6 4; i++ )
{
mat b[i] = _ml d(b [i] );
c[i] = _mm x(a [i] );
}
Example 2:
for (i= 0; i<6 4; i++ )
{
c[i] = _ml dmx (a[ i], b[i ]);
}
Fortran examples:
The array syntax used for the bit matrix operations in this example is simple enough to vectorize even with
optimization disabled.
This simple example demonstrates a bit matrix transposition. The bit matrix used is similar to the following,
but the one used is actually much larger:
111 1 100 0
011 1 to 110 0
001 1 111 0
000 1 111 1
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
CF90 Commands and Directives Reference Manual
NAME
BTEST, BITEST, BJTEST, BKTEST – Tests a bit of an integer value
SYNOPSIS
BTEST ([I=]i, [POS=]pos)
BITEST ([I=]i, [POS=]pos)
BJTEST ([I=]i, [POS=]pos)
BKTEST ([I=]i, [POS=]pos)
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: BITEST, BJTEST, BKTEST
DESCRIPTION
The BTEST, BITEST, BJTEST, and BKTEST intrinsic functions test a bit of an integer value. They accept
the following arguments:
i Must be of type integer. For BITEST, it must be an integer (KIND=2) value. For BJTEST, it
must be an integer (KIND=4) value. For BKTEST, it must be an integer (KIND=8) value.
pos Must be of type integer. For BITEST, it must be an integer (KIND=2) value. For BJTEST, it
must be an integer (KIND=4) value. For BKTEST, it must be an integer (KIND=8) value. It
must be nonnegative and be less than BIT_SIZE(i).
BTEST, BITEST, BJTEST, and BKTEST are elemental functions. The names of these intrinsics cannot be
passed as arguments.
RETURN VALUES
BTEST returns type default logical. BITEST returns type logical (KIND=2). BJTEST returns type logical
(KIND=4). BKTEST returns type logical (KIND=8).
The result has the value TRUE if bit pos of i has the value 1. It has the value FALSE if bit pos of i has the
value 0. The bit model defines the interpretation of an integer value as a sequence of bits. This model is
described in the MODELS(3I) man page.
EXAMPLES
Example 1: BTEST(8,3) yields TRUE.
Example 2: BTEST(8_SHORT,3) yields TRUE.
Example 3: Assume that A has the following value:
12
34
BTEST(A,2) yields:
false false
false true
BTEST(2,A) yields:
true false
false false
SEE ALSO
MODELS(3I)
NAME
CEILING – Returns the least integer greater than or equal to a
SYNOPSIS
CEILING ([A=]a [,[KIND=]kind])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The CEILING intrinsic function returns the least integer greater than or equal to a. It accepts the following
arguments:
a Must be of type real
kind An integer scalar value. Must be a scalar integer initialization expression
CEILING is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
On UNICOS systems, both execution speed and the number of bits used in mathematical operations are
affected when compiling with f90 -O fastint, which is the default setting. For more information on
this, see the CF90 Commands and Directives Reference Manual.
RETURN VALUES
The result type is an integer. If kind is specified, the kind type parameter is that specified by kind. If kind is
not specified, the result is of type default integer. The result has a value equal to the least integer greater
than or equal to a. The result is undefined if the system cannot represent this value in the default integer
type.
EXAMPLES
CEILING(3.7) yields 4.
CEILING(-3.7) yields -3.
SEE ALSO
CF90 Commands and Directives Reference Manual
NAME
CHAR, ACHAR, ICHAR, IACHAR – Performs conversion and positioning functions
SYNOPSIS
CHAR([I=]i, [KIND=]kind)
ACHAR([I=]i)
ICHAR([C=]c)
IACHAR ([C=]c)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
DESCRIPTION
CHAR and ICHAR are inverse functions. CHAR converts an integer or Boolean argument to a character
specified by the ASCII collating sequence. ICHAR converts a character argument to an integer based on the
character position in the collating sequence. CHAR and ICHAR assign the appropriate type to Boolean
arguments without shifting or manipulating the bit patterns they represent. For example, CHAR(i) returns the
ith character in the collating sequence.
ACHAR returns the character in a specified position of the ASCII collating sequence. This intrinsic is not
accepted by the MIPSpro Fortran 77 compiler.
IACHAR returns the position of a character in the ASCII collating sequence. This intrinsic is not accepted
by the MIPSpro Fortran 77 compiler.
These intrinsic functions accept the following arguments:
i For CHAR and ICHAR, must be of type integer or Boolean. If of type integer, i must be in the
range 0 ≤ i ≤ 255.
For ACHAR, must be of type integer.
kind An integer scalar value. Must be a scalar integer initialization expression. This argument is not
accepted by the MIPSpro Fortran 77 compiler.
c Must be of type character and of length 1.
These are elemental functions. The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
CHAR returns a character of length one. If the kind parameter is present, the kind type parameter is that
specified by kind. Otherwise the kind type parameter is that of the default character type. The result is the
character in position i of the ASCII collating sequence associated with the specified kind type parameter.
ACHAR returns a character of length 1. If i has a value in the range 0 ≤ i ≤ 127, the result is the character in
position i of the ASCII collating sequence. ACHAR (IACHAR (c)) has the value c for any character c
capable of representation.
ICHAR returns a default integer value. For ICHAR, the result is the position c in the collating sequence
associated with the kind type parameter of c and is in the range 0 ≤ ICHAR(c) ≤ 255. For any characters C
and D capable of being represented, C .LE. D is true if and only if ICHAR (C) .LE. ICHAR(D) is
true and C .EQ. D is true if and only if ICHAR(C) .EQ. ICHAR(D) is true.
IACHAR returns a default integer value. If c is in the collating sequence defined by the codes specified in
ISO 646:1983 (International Reference Version), the result is the position of c in that sequence and satisfies
the inequality 0 ≤ IACHAR (c) ≤ 127. The results are consistent with the LGE, LGT, LLE, and LLT
lexical comparison functions. For example, if LLE(C,D) is true, IACHAR(C).LE.IACHAR(D) is true
when C and D are any two ASCII characters.
EXAMPLES
IACHAR(’X’) yields the value 88.
ACHAR(88) yields ’X’.
NAME
CLEAR_IEEE_EXCEPTION – Clears floating-point exception indicator
SYNOPSIS
CLEAR_IEEE_EXCEPTION ([EXCEPTION=]exception)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The CLEAR_IEEE_EXCEPTION intrinsic subroutine clears the specified floating-point exception indicator.
It accepts the following argument:
exception Must be of type default integer. It is an INTENT(IN) argument. If exception is an
array, it must be 1-dimensional. The single argument in the scalar case, or each array
element in the array case, must be set to one of the values represented by the following
named constants:
• IEEE_XPTN_CRI_INVALID_OPND (accepted only on Cray T90 systems that support
IEEE floating-point arithmetic)
• IEEE_XPTN_INEXACT_RESULT
• IEEE_XPTN_UNDERFLOW
• IEEE_XPTN_OVERFLOW
• IEEE_XPTN_DIV_BY_ZERO
• IEEE_XPTN_INVALID_OPR
• IEEE_XPTN_ALL (all exceptions in this list)
The name of this intrinsic cannot be passed as an argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN_IE EE_DEF INI TIO NS
RETURN VALUES
The exception indicator specified by exception (or each element of exception) is cleared so it now indicates
that the exception has not occurred.
EXAMPLES
DO i = 1, n
x(i ) = CVM GN( 0.0, x, MASK)
END DO
END IF
SEE ALSO
GET_IEEE_EXCEPTIONS(3I), SET_IEEE_EXCEPTION(3I), TEST_IEEE_EXCEPTION(3I).
NAME
CLOC – Obtains the Fortran Character Descriptor (FCD) of a character entity
SYNOPSIS
CLOC ([C=]c)
IMPLEMENTATION
UNICOS, UNICOS/mk systems
CF90
STANDARDS
Fortran extension
DESCRIPTION
The CLOC intrinsic function returns the FCD of a character entity. It accepts the following argument:
c Must be a variable of type character
The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The value returned is of type Cray character pointer.
NAME
CLOCK – Returns the current time
SYNOPSIS
CLOCK ()
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
CLOCK obtains the current time, in ASCII hh:mm:ss format, from the real-time clock.
CLOCK accepts no arguments. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The data type of the return value depends on your platform. On UNICOS and UNICOS/mk systems, the
return value is of type Boolean. On IRIX systems, it is of type CHARACTER*8.
NOTES
The CLOCK intrinsic function is outmoded. Refer to the Fortran Language Reference Manual, Volume 3,
for information on outmoded features and their preferred standard alternatives.
NAME
CMPLX, DCMPLX, QCMPLX – Converts to type complex
SYNOPSIS
CMPLX ([X=]x [,[Y=]y] [,[KIND=]kind])
DCMPLX ([X=]x [,[Y=]y])
QCMPLX ([X=]x [,[Y=]y])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: DCMPLX, QCMPLX
DESCRIPTION
CMPLX is a generic function name; the others are specifics. These are elemental intrinsic functions. These
functions convert x and (if specified) y into type complex. Their arguments are as follows:
x The real part of complex number. Must be type integer, Boolean, real, complex, double
precision, or quad precision. If x is of type complex, argument y cannot be specified.
See the RETURN VALUES section for more information on input data types and return values.
y The imaginary part of a number. Must be of the same type and kind type as x. If unspecified,
zero is assumed.
kind An integer scalar value. The kind type assigned to the result. Must be a valid kind type for
type complex on your platform. Kind types accepted differ from platform to platform, see
Fortran Language Reference Manual, Volume 1, for information on valid types and kind types
allowed.
This argument is not accepted by the MIPSpro Fortran 77 compiler.
Type conversion routines assign the appropriate type to Boolean arguments without shifting or manipulating
the bit patterns they represent.
The following cases represent the evaluation of CMPLX when using both arguments:
• CMPLX(I,J) yields FLOAT(I)+i*FLOAT(J).
• CMPLX(x,y) yields the complex value x+i*y.
The following cases represent the evaluation of CMPLX when using the first argument:
• CMPLX(X) yields X+i*0.
• CMPLX(I) yields FLOAT(I)+i*0.
• If C is complex, CMPLX(C) yields C.
NOTES
The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
If the kind argument is specified, the kind type of the result is the same as the kind argument.
If the kind argument is not specified, the following return values are obtained:
• CMPLX returns a complex value.
• DCMPLX returns a double-complex value.
• QCMPLX returns a quad-complex value.
NAME
_cmr – Assures completion of memory references
SYNOPSIS
#include <intrinsics.h>
void _cmr (void);
IMPLEMENTATION
UNICOS systems
STANDARDS
Cray C/C++ extension
DESCRIPTION
The _cmr function assures completion of all memory references within the current central processing unit
(CPU).
C/C++ NOTES
Because _cmr is an intrinsic function, no externally visible library function is available for it. The compiler
generates inline code to produce the result.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
COMPL – Computes complement
SYNOPSIS
COMPL ([I=]i)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
The COMPL intrinsic function computes the complement of i. It accepts the following argument:
i A Boolean, integer, real, logical, or Cray pointer value.
COMPL is an elemental function. The name of this intrinsic cannot be passed as an argument.
The following tables show both the logical complement and the bit-wise logical complement:
T F
F T
1 0
0 1
NOTES
COMPL is outmoded. Refer to the Fortran Language Reference Manual, Volume 2, for information about
outmoded features and their preferred standard alternatives.
CAUTIONS
Unexpected results can occur when Boolean functions are declared external and then used with logical
arguments. On UNICOS and UNICOS/mk systems, the external Boolean functions always treat their
arguments as type Boolean and return a Boolean result. On IRIX systems, the result is an integer.
RETURN VALUES
When given an argument of type logical, COMPL computes a logical complement and returns a logical result.
On UNICOS and UNICOS/mk systems, with an argument of type integer, real, Boolean, or Cray pointer,
COMPL computes a bit-wise logical complement and returns a Boolean result. No type conversion occurs.
On IRIX systems, with an argument of type integer, real, Boolean, or Cray Pointer, COMPL computes a
bit-wise logical complement and returns an integer result.
EXAMPLES
The following section of Fortran code shows the COMPL function used with an argument of type logical:
LOGICA L L1, L2
...
L2 = COM PL(L1)
The following section of Fortran code shows the COMPL function used with an argument of type integer.
The bit patterns of the argument and result are also given. For clarity, only the rightmost 8 bits are shown.
INTEGE R I1, I2
I1 = 240
...
I2 = COM PL(I1)
NAME
CONJG, DCONJG, QCONJG – Computes conjugate of a complex number
SYNOPSIS
CONJG ([Z=]z])
DCONJG ([Z=]z])
QCONJG ([Z=]z])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: DCONJG, QCONJG
DESCRIPTION
CONJG, DCONJG, and QCONJG return the conjugate of a complex number. CONJG is the generic function
name; the others are specifics. These are elemental intrinsic functions. They accept the following argument:
z Must be type complex. See the RETURN VALUES section for information on input data types
and return values.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
This function evaluates y = z r – iz i .
NOTES
The CONJG intrinsic function name can be passed as an argument; the others cannot.
RETURN VALUES
CONJG returns the complex conjugate of a complex number.
DCONJG returns the double-precision complex conjugate of a double-complex number.
QCONJG returns the quad-precision complex conjugate of a quad-precision complex number.
EXAMPLES
The following program gives RESULT=(3.0,-4.0):
PRO GRAM CONTES T
COM PLEX ARG, RES ULT
ARG =(3.0, 4.0)
RES ULT=CO NJG(AR G)
PRI NT *,R ESULT
STO P
END
NAME
COS, DCOS, QCOS, CCOS, CDCOS, CQCOS, COSD, DCOSD, QCOSD – Computes cosine
SYNOPSIS
COS ([X=]x)
DCOS ([X=]x)
QCOS ([X=]x)
CCOS ([X=]x)
CDCOS ([X=]x)
CQCOS ([X=]x)
COSD ([X=]x)
DCOSD ([X=]x)
QCOSD ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk and IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QCOS, CDCOS, CQCOS, COSD, DCOSD, QCOSD
DESCRIPTION
These functions evaluate y = cos(x).
COS and COSD are the generic function names; the others are specifics. These are elemental intrinsic
functions. They accept the following argument:
x Must be of type real. For COS, DCOS, QCOS, CCOS, CDCOS, and CQCOS, the argument must
be in radians. It is treated as (modulo 2 * pi). For COSD, DCOSD, and QCOSD, the argument
must be in degrees and is treated as modulo 360.
See the RETURN VALUES section for more information on input data types and return values.
Vector versions of these intrinsics exist on some systems. Vector versions of the COS, DCOS, CCOS, and
CDCOS intrinsic functions exist on UNICOS and UNICOS/mk systems. On UNICOS/mk systems, the vector
versions of these intrinsics are used when -O vector3 or -O3 are specified on the compiler command
line. A vector version of the single-precision and double-precision COS intrinsic exists on IRIX systems and
is used when -O3 is specified on the compiler command line.
NOTES
The COS, DCOS, CCOS intrinsic function names can be passed as arguments; the others cannot.
On UNICOS/mk systems and on UNICOS systems that support the IEEE standard for floating-point
25
arithmetic, COS(x) yields NaN if x > 2 .
On UNICOS systems that do not support the IEEE standard for floating-point arithmetic, COS(x) yields 0 if
25
x > 2 .
19
On IRIX systems, COS(x) yields NaN if x > pi * 2 .
On all systems that support the IEEE standard for floating-point arithmetic, COS(x) yields NaN if x = NaN.
RETURN VALUES
COS and COSD return the single-precision cosine of their single-precision arguments.
DCOS and DCOSD return the double-precision cosine of their double-precision arguments.
QCOS and QCOSD return the quad-precision cosine of their quad-precision arguments.
CCOS returns the complex cosine of its complex argument.
CDCOS returns the complex double-precision cosine of its complex double-precision argument.
CQCOS returns the complex quad-precision cosine of its complex quad-precision argument.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
NAME
COSH, DCOSH, QCOSH – Computes hyperbolic cosine
SYNOPSIS
COSH ([X=]x)
DCOSH ([X=]x)
QCOSH ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QCOSH
DESCRIPTION
COSH is the generic function name; the others are specifics. COSH, DCOSH, and QCOSH are elemental
intrinsic functions. These are elemental functions. They accept the following argument:
x Must be of type real. The type and kind type of x is identical to the type and kind type of the
return value. See the RETURN VALUES section for more information on input data types and
return values.
x –x
These functions evaluate y = cosh(x) = (e + e ) / 2.
NOTES
The COSH and DCOSH intrinsic function names can be passed as arguments; the other cannot.
On Cray T90 systems that support IEEE arithmetic, the following return values occur:
• If x > 709.78, COSH(x) yields infinity.
• If x = NaN, COSH(x) yields NaN.
RETURN VALUES
COSH returns the single-precision real hyperbolic cosine of its single-precision real argument.
DCOSH returns the double-precision real hyperbolic cosine of its double-precision real argument.
QCOSH returns the quad-precision real hyperbolic cosine of its quad-precision real argument.
NAME
COT, COTAN, DCOT, DCOTAN, QCOT, CQCOTAN – Computes cotangent
SYNOPSIS
COT ([X=]x)
COTAN ([X=]x)
DCOT ([X=]x)
DCOTAN ([X=]x)
QCOT ([X=]x)
QCOTAN ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extensions
DESCRIPTION
COT is the generic function name; the others are specifics. They are elemental intrinsic functions. They
accept the following argument:
x Must be of type real. The type and kind type of x is identical to the type and kind type of the
return value. See the RETURN VALUES section for more information on input data types and
return values.
These functions evaluate y = COT(x).
NOTES
The COT and DCOT intrinsic function names can be passed as arguments; the others cannot.
On UNICOS/mk systems and on UNICOS systems that support the IEEE standard for floating-point
25
arithmetic, if x > pi * 2 or if x = NaN, COT(x) yields NaN.
25
On UNICOS systems that do not support the IEEE standard for floating-point arithmetic, if x > pi * 2 or
if x = 0, COT(x) yields 0.
19
On IRIX systems, if x > pi * 2 or if x = NaN, COT(x) yields NaN.
RETURN VALUES
COT and COTAN return the single-precision real cotangent of their single-precision real arguments.
DCOT and DCOTAN return the double-precision real cotangent of their double-precision real arguments.
QCOT and QCOTAN return the quad-precision real cotangent of their quad-precision real arguments.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
NAME
COUNT – Counts the number of true array elements
SYNOPSIS
COUNT ([MASK=]mask [,[DIM=]dim])
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The COUNT intrinsic function counts the number of true array elements of argument mask along dimension
dim. It accepts the following arguments:
mask Must be of type logical. It must not be a scalar.
dim Must be a scalar. It is an integer with a value in the range 1 ≤ dim ≤ n, where n is the rank of
mask. The corresponding actual argument must not be an optional dummy argument.
COUNT is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is type integer. It is a scalar result if dim is absent or if mask has rank 1. Otherwise, the result is
an array of rank n– 1 and of shape (d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ), where (d 1 , d 2 , . . ., d n ) is the shape of
mask.
The result of COUNT(mask) has a value equal to the number of TRUE elements of mask or has the value 0
if mask is a zero-sized array.
If mask has rank 1, COUNT(mask, dim) has a value equal to that of COUNT(mask). Otherwise, the value
of element (s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ) of COUNT(mask, dim) is equal to
COUNT(MASK (s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )).
EXAMPLES
Example 1:
• COUNT((/.TRUE.,.FALSE.,.TRUE./)) yields 2.
• COUNT(mask) yields 0 when mask is a zero-sized array.
NAME
CPU_TIME – Returns the processor time
SYNOPSIS
CPU_TIME ([TIME=]time)
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The CPU_TIME intrinsic subroutine returns the user time if successful. This intrinsic subroutine accepts the
following argument:
time Must be a scalar and of type real. It is an output argument. The type of the argument is not
restricted to any particular kind type.
The name of this intrinsic cannot be passed as an argument. The time returned by this intrinsic subroutine is
user time on all systems.
On UNICOS and UNICOS/mk systems, a call to CPU_TIME must be done once and before the first timing
loop to initialize the time structure. CPU_TIME includes time accumulated by all processors in a
multitasking program.
RETURN VALUES
CPU_TIME yields -1.0 if the time cannot be returned.
EXAMPLES
The following program uses the CPU_TIME intrinsic subroutine and was run on an IRIX system:
NAME
CSHIFT – Performs a circular shift on an array expression
SYNOPSIS
CSHIFT ([ARRAY=]array, [SHIFT=]shift [, [DIM=]dim])
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The CSHIFT intrinsic function performs a circular shift on an array expression of rank 1 or performs
circular shifts on all the complete rank 1 sections along a given array expression of rank 2 or greater.
Elements shifted out at one end are shifted in at the other end. Different sections can be shifted by different
amounts and in different directions; positive for left shifts, negative for right shifts.
CSHIFT accepts the following arguments:
array Can be of any type. It must not be a scalar.
shift Must be integer. If array has rank 1, shift must be a scalar. Otherwise, shift must be scalar or
have rank n– 1 and have shape (d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ), where (d 1 , d 2 , . . ., d n ) is the
shape of array.
dim Must be a scalar. It is an integer with a value in the range 1 ≤ dim ≤ n, where n is the rank of
array. If dim is omitted, a value of 1 is assumed.
CSHIFT is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is an array of the same type, type parameters, and shape as array.
If array has rank 1, element i of the result is array(1 + modulo(i + shift - 1, size(array))).
If array has rank greater than 1, section (s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n ) of the result has a value equal
to CSHIFT(array (s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n ), sh, 1), where sh is shift or
shift(s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n )
EXAMPLES
Example 1: If V is a rank 1 array [1,2,3,4,5,6], the effect of shifting V circularly to the left by two
positions is achieved by CSHIFT(V,SHIFT=2), which has the value [3,4,5,6,1,2]. Specifying
CSHIFT(V,SHIFT=-2) achieves a circular shift to the right by two positions and has the value
[5,6,1,2,3,4].
Example 2: The rows of an array of rank 2 can all be shifted by the same amount or by different amounts.
Assume M is the following array:
| 1 2 3 |
| 4 5 6 |
| 7 8 9 |
CSHIFT(M,SHIFT=-1,DIM=2) yields:
| 3 1 2 |
| 6 4 5 |
| 9 7 8 |
CSHIFT(M,SHIFT=(/-1,1,0),DIM=2) yields:
| 3 1 2 |
| 5 6 4 |
| 7 8 9 |
CSHIFT(N,SHIFT=-1,DIM=1) yields:
| 9 10 11 12 |
| 1 2 3 4 |
| 5 6 7 8 |
NAME
CSMG – Performs a conditional scalar merge
SYNOPSIS
CSMG ([I=]i, [J=]j, [K=]k)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
The CSMG intrinsic function merges i and j, controlled by the bit mask in k. When a 1 bit appears in k, the
corresponding bit of i becomes the corresponding bit of the result. When a 0 bit appears in k, the
corresponding bit of j is taken. Therefore, CSMG(i, j, k) equals the following specification:
(i .AND. k) .OR . (j .AN D. .NO T. k)
NOTES
The CSMG intrinsic function is outmoded. Refer to the Fortran Language Reference Manual, Volume 3, for
information on outmoded features and their preferred standard alternatives.
RETURN VALUES
On UNICOS and UNICOS/mk systems, the return value is of type Boolean. On IRIX systems, the return
value is of type integer.
EXAMPLES
Example 1: Specifying CSMG(i,j,MASK(64)) or CSMG(i,j,-1) yields i.
Example 2: CSMG(i,j,0) yields j.
Example 3: Specifying the conditional scalar merge
CSMG(’ABCDEFGH’H,’12345678’H,X’0000FFFFFF0000FF’) yields ’12CDE67H’H as the result.
Example 4: This example applies only to UNICOS systems.
INT EGER EXP ONE NT, EXP MAS K
PAR AMETER ( EXP MAS K = X’7 FFF 000 000 000 000 ’ )
C Sta tement fun cti on:
EXP ONENT( X) = SHI FTR (X .AN D. EXP MAS K, 48)
C Sta tement fun cti on:
DIV BY2(X) =
& CSM G( SHI FTL (EX PON ENT (X) -1, 48) ,
& X,
& EXP MAS K )
NAME
CVMGM, CVMGN, CVMGP, CVMGT, CVMGZ – Conditional vector merge functions
SYNOPSIS
CVMGM ([I=]i, [J=]j, [K=]k)
CVMGN ([I=]i, [J=]j, [K=]k)
CVMGP ([I=]i, [J=]j, [K=]k)
CVMGT ([I=]i, [J=]j, [K=]k)
CVMGZ ([I=]i, [J=]j, [K=]k)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
At run time, k is tested. You can use the conditional vector merge (CVMG) functions when an IF statement
involving arrays prevents vectorization of a loop. The compiler can vectorize almost all such loops, but
these functions can be used in older codes. Scalar arguments can also be used with these functions.
CVMG functions cannot be passed as arguments. They are elemental functions.
These functions test for the following:
• CVMGM tests for minus (negative). i is returned if k < 0. j is returned if k ≥ 0.
• CVMGN tests for nonzero. i is returned if k ≠ 0. j is returned if k = 0.
• CVMGP tests for positive or zero. i is returned if k ≥ 0. j is returned if k < 0.
• CVMGT tests for true. i is returned if k is true. j is returned if k is false.
• CVMGZ tests for zero. i is returned if k = 0. j is returned if k ≠ 0
These functions accept the following arguments:
i Can be of type logical, Boolean, integer, real, or Cray pointer.
See the RETURN VALUES section of this man page for more information on how the type of i
affects the return value.
However, when used in an expression with another operand, a CVMG function value takes on the type of
the other operand, without any explicit type conversion. For example, the following expression uses real
arithmetic:
X = 1.0 + CVM GT( 2.0,3. 0,L EXP) ! Val id (ty pes agree)
The following suggestions explain how to prevent bugs when using these functions:
• Use only one CVMG function in a given expression. If you use more than one CVMG function in an
expression, use explicit type conversion. This does not generate any additional code. For example:
X = REAL(CVMG T(1 .0,2.0 ,LTEST )) + REAL(C VMGT(X ,Y,LTE ST2))
• Ensure that the assignment type matches the function argument. Example:
X = CVMGT(1.0 ,2. 0,LTES T) ! Valid
X = REAL(CVMG T(1 ,2,LTE ST)) ! Val id (us es exp licit type conver sion)
X = CVMGT(1,2 ,LT EST) ! Inv alid (type mismat ch)
• Never use mixed typing in the first two arguments of a CVMGT function. Example:
NOTES
The CVMG intrinsic functions are outmoded. Refer to the Fortran Language Reference Manual, Volume 3,
for information on outmoded features and their preferred standard alternatives.
RETURN VALUES
For CVMGM, CVMGN, CVMGP, CVMGT, and CVMGZ, the return value is either type Boolean, logical, integer,
or real, depending on the type of i and j.
On UNICOS and UNICOS/mk systems, type logical is returned if i is of type logical; otherwise it is of type
Boolean.
On IRIX systems, if i and j are both of type real, the result type is also real. If i is of type logical, type
logical is returned. In all other cases, the return value is of type integer.
EXAMPLES
Consider the following code:
DO I = N,M
X(I ) = A(I )
IF (B( I) .GT. C(I)) X(I ) = D(I )
END DO
NAME
DATE, JDATE – Returns the current date
SYNOPSIS
DATE()
JDATE()
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
DATE and JDATE return the current date. DATE returns the current date in ASCII mm/dd/yy format.
JDATE returns the current Julian day-number facsimile in ASCII yyddd format, left-justified and blank-filled.
If called as intrinsic functions, DATE and JDATE do not accept any arguments. The names of these
intrinsics cannot be passed as arguments.
RETURN VALUES
When called as an intrinsic function, the data type of the return value depends on your platform. On
UNICOS and UNICOS/mk systems, it is of type Boolean. On IRIX systems, it is of type CHARACTER*8.
NOTES
The DATE and JDATE intrinsic functions are outmoded. Refer to the Fortran Language Reference Manual,
Volume 3, for information on outmoded features and their preferred standard alternatives.
For both DATE and JDATE, the year will become 0 in the year 2000.
NAME
DATE_AND_TIME – Returns data on the real-time clock and date
SYNOPSIS
CALL DATE_AND_TIME ([[DATE=]date] [,[TIME=]time] [,[ZONE=]zone] [,[VALUES=]values])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The DATE_AND_TIME intrinsic subroutine returns data on the real-time clock and date. The time returned
is local but the difference between local time and Coordinated Universal Time (UTC) can be determined.
Note that UTC is also known as Greenwich Mean Time.
The DATE_AND_TIME intrinsic subroutine accepts the following arguments:
date Must be a scalar of type character. It must be at least 8 characters long to contain the complete
value. It is an output argument, and the leftmost 8 characters are set to a value of the form
CCYYMMDD, where CC is the century, YY is the year within the century, MM is the month
within the year, and DD is the day within the month. If there is no date available, date is set to
blanks.
time Must be a scalar of type character. It must be at least 10 characters long to contain the complete
value. It is an output argument, and the leftmost 10 characters are set to a value of the form
hhmmss.sss, where hh is the hour of the day, mm is the minutes of the hour, and ss.sss is
seconds and milliseconds of the minute. If there is no clock available, time is set to blanks.
zone Must be a scalar of type character. It must be at least 5 characters long to contain the complete
value. It is an output argument whose leftmost 5 characters are set to a value of the form
±hhmm, where hh and mm are the time difference with respect to UTC in hours and parts of an
hour expressed in minutes, respectively. If there is no clock available, zone is set to blanks.
values Must be of type default integer and of rank one. It is an output argument and must have at least
8 elements. The values returned in values are as follows:
Values Return Value
values(1) The year (that is, 1990), or -HUGE (0) if there is no date available
values(2) The month of the year (1-12), or -HUGE (0) if there is no date available
values(3) The day of the month (1-31), or -HUGE (0) if there is no date available
values(4) The time difference, in minutes, with respect to UTC, or -HUGE (0) if this
information is not available
values(5) The hour of the day, in the range of 0 to 23, or -HUGE (0) if there is no clock
values(6) The minutes of the hour, in the range 0 to 59, or -HUGE (0) if there is no clock
values(7) The seconds of the minute, in the range 0 to 60, or -HUGE (0) if there is no
clock
values(8) The milliseconds of the second, in the range 0 to 999, or -HUGE (0) if there is
no clock.
DATE_AND_TIME is an intrinsic subroutine. The name of this intrinsic cannot be passed as an argument.
EXAMPLES
The following program uses the DATE_AND_TIME intrinsic subroutine:
INT EGE R dat e_time(8)
CHARACTER (LEN=1 0) big_ben(3 )
CAL L DAT E_A ND_TIME(b ig_ ben(1) , big _ben(2 ), big _ben(3 ), dat e_time )
PRINT *,’ date_t ime arr ay val ues:’
PRINT *,’ year=’ ,da te_time(1 )
PRINT *,’ mon th_of_yea r=’ ,da te_tim e(2)
PRINT *,’ day _of_month =’, dat e_time (3)
PRINT *,’tim e dif fer ence in minute s=’,da te_tim e(4)
PRINT *,’ hour of day =’, dat e_time (5)
PRINT *,’ min utes of hour=’ ,da te_ tim e(6 )
PRINT *,’ second s of min ute=’, date_t ime(7)
PRINT *,’mil liseco nds of sec ond =’, dat e_t ime (8)
PRINT *, ’DA TE=’,big_ ben (1)
PRINT *, ’TI ME= ’,big_ben (2)
PRINT *, ’ZONE= ’,b ig_ben(3)
END
When this program was run in Minnesota, USA, on June 1, 1994, at approximately 5:39 PM, on a UNICOS
system, it generated the following output:
When this program was run in Minnesota, USA, on May 2, 1997, at approximately 9:34 AM, on an IRIX
system, it generated the following output:
date_t ime arr ay values :
year=1 997
mon th_of_ yea r=5
day _of_mo nth =2
tim e differenc e in min ute s=3 00
hour of day =9
min utes of hou r=3 4
sec onds of min ute =39
mil liseco nds of sec ond =583
DAT E=1997 050 2
TIM E=0934 39. 583
ZON E=-050 0
NAME
DBLE – Converts to double-precision real
SYNOPSIS
DBLE ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
DESCRIPTION
This intrinsic function converts the specified type to double precision. This is an elemental intrinsic
functions. It accepts the following arguments:
a Must be type integer, real, or complex.
If a is of type complex, an approximation of the real part of a is returned. As much precision as
possible is retained.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
NOTES
The name of this intrinsic function cannot be passed as arguments.
RETURN VALUES
DBLE returns the double-precision equivalent of its argument.
NAME
DIGITS – Returns the number of significant digits
SYNOPSIS
DIGITS ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The DIGITS intrinsic function returns the number of significant digits in the model representing numbers of
the same type and kind type parameter as the argument. The number returned is the number of significant
radix digits (base 2 digits), not decimal digits. It accepts the following argument:
x Must be of type integer or real. It can be scalar or array valued.
DIGITS is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type is an integer scalar. The result has the value q if x is of type integer. It has the value p if x
is of type real. The values q and p are defined on the MODELS(3I) man page.
EXAMPLES
The following code fragment was run on several systems:
INTEGE R(KIND =1) i1
INTEGE R(KIND =2) i2
INTEGE R(KIND =4) i4
INTEGE R(KIND =8) i8
INTEGE R id
PRINT *,’DIG ITS i1= ’,D IGI TS( i1)
PRINT *,’DIG ITS i2= ’,D IGI TS( i2)
PRINT *,’DIG ITS i4= ’,D IGI TS( i4)
PRINT *,’DIG ITS i8= ’,DIGI TS( i8)
PRINT *,’DIG ITS id= ’,D IGI TS( id)
END
SEE ALSO
MODELS(3I)
NAME
DIM, DDIM, QDIM, IDIM, IIDIM, JIDIM, KIDIM – Computes positive difference of two numbers
SYNOPSIS
DIM ([X=]x,[Y=]y)
DDIM ([X=]x,[Y=]y)
QDIM ([X=]x,[Y=]y)
IDIM ([X=]x,[Y=]y)
IIDIM ([X=]x,[Y=]y)
JIDIM ([X=]x,[Y=]y)
KIDIM ([X=]x,[Y=]y)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QDIM, IIDIM, JIDIM, KIDIM
DESCRIPTION
DIM is the generic function name; the others are specifics. These are elemental intrinsic functions. They
accept the following arguments:
x Must be of type integer or real.
y Must be of the same type and kind type as x.
These functions solve for:
R = x 1 – x 2 , if x 1 > x 2
R = 0, if x 1 ≤ x 2
NOTES
The DIM, IDIM, and DDIM intrinsic funtion names can be passed as arguments; the others cannot.
RETURN VALUES
DIM evaluates two real numbers and subtracts them. The result is a real positive difference.
DDIM evaluates two double-precision real numbers and subtracts them. The result is a double-precision real
positive difference.
QDIM evaluates two quad-precision real numbers and subtracts them. The result is a quad-precision real
positive difference.
IDIM evaluates two integers and subtracts them. The result is an integer positive difference.
IIDIM evaluates two integer (KIND=2) numbers and subtracts them. The result is an integer (KIND=2)
positive difference.
JIDIM evaluates two integer (KIND=4) numbers and subtracts them. The result is an integer (KIND=4)
positive difference.
KIDIM evaluates two integer (KIND=8) numbers and subtracts them. The result is an integer (KIND=8)
positive difference.
EXAMPLES
The following program shows the use of IDIM to compute the positive difference between the integers 77
and 10:
PRO GRAM DIMTES T
INT EGER A,B,C, D,E
A = 77
B = 10
C = IDIM(A ,B)
WRITE 1,A ,B,C
1 FORMAT (I2 ,’POSI TIV E DIFFER ENCE ’,I2,’ EQU ALS ’, I2)
D = IDI M(B,A)
WRITE 2,B ,A,D
2 FORMAT (I2 ,’POSI TIV E DIFFER ENCE ’,I2,’ EQU ALS ’,I2)
STOP
END
NAME
DOT_PRODUCT – Performs dot-product multiplication of numeric or logical vectors
SYNOPSIS
DOT_PRODUCT ([VECTOR_A=]vector_a, [VECTOR_B=]vector_b)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The DOT_PRODUCT intrinsic function performs dot-product multiplication of numeric or logical vectors. It
accepts the following arguments:
vector_a Must be of numeric type (integer, real, or complex) or of logical type. It must be array valued
and of rank one.
vector_b Must be of numeric type if vector_a is of numeric type or of type logical if vector_a is of type
logical. It must be array valued and of rank one. It must be conformable to vector_a.
DOT_PRODUCT is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
If the arguments are of numeric type, the type and kind type parameter of the result are those of the
expression vector_a * vector_b, determined by the types of the arguments. If the arguments are of type
logical, the result is of type logical with the kind type parameter of the expression vector_a .AND.
vector_b.
The result is scalar.
If vector_a is of type integer or real, the result has the value
SUM(vector_a*vector_b). If the vectors have size zero, the result has the value 0.
If vector_a is of type complex, the result has the value
SUM(CONJG(vector_a)*vector_b). If the vectors have size zero, the result has the value 0.
If vector_a is of type logical, the result has the value
ANY(vector_a.AND.vector_b). If the vectors have size 0, the result has the value FALSE.
EXAMPLES
DOT_PRODUCT((/1,2,3/),(/2,3,4/)) yields 20.
NAME
DPROD, QPROD – Computes double-precision or quad-precision product of two real numbers
SYNOPSIS
DPROD ([X=]x,[Y=]y)
QPROD ([X=]x,[Y=]y)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QPROD
DESCRIPTION
DPROD returns the double-precision real product of its two real arguments. QPROD returns the
quad-precision real product of its two real arguments. These are elemental functions. They accept the
following arguments:
x Must be of type single-precision real or double-precision real. See the RETURN VALUES
section for information on input data types and return values.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
y Must be of the same type and kind type as x.
These functions evaluate y = x * y.
RETURN VALUES
DPROD returns the double-precision real product of two real arguments.
QPROD returns the quad-precision real product of two real arguments.
NOTES
The name of this intrinsic can be passed as an argument.
EXAMPLES
The following program calls DPROD to compute the double-precision product of the two real numbers 5.0
and 6.0:
PRO GRAM DOUBT
REA L X,Y
DOUBLE PRE CISION Z
X=5.0
Y=6.0
Z=DPRO D(X,Y)
PRINT *, Z
STOP
END
The preceding program gives Z to be the double-precision number 30.0 (or in Fortran, 30.D0).
NAME
_dshiftl, DSHIFTL – Performs a double-object left shift
SYNOPSIS
C/C++:
#include <intrinsics.h>
long _dshiftl (long i, long j, long k);
Fortran:
DSHIFTL ([I=]i, [J=]j, [K=]k)
IMPLEMENTATION
C/C++: UNICOS, UNICOS/mk
Fortran: UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
The _dshiftl and DSHIFTL functions perform a double-object left shift. They return a single object.
The result is derived from two arguments, i and j. The arguments are as follows:
i The upper bits of the double object. Must be of type integer.
j The lower bits of the double object. Must be of the same type and size as i.
k The number of bits to be shifted. Must be of type integer.
The _dshiftl and DSHIFTL functions return a value generated by a left double-shift of the leftmost k bits
of j into the rightmost k bits of i. If both the i and j arguments specify the same word in memory, a circular
shift occurs. The value of k must be in the range of 0 through 64 for _dshiftl.
NOTES
C/C++
Because _dshiftl is an intrinsic function, no externally visible library function is available for it. The
compiler generates inline code to produce the result.
Fortran
On UNICOS systems, i and j are 64-bit objects. On UNICOS/mk systems, i and j can be 32- or 64-bit
objects. On IRIX systems, i and j can be 8-, 16-, 32-, or 64-bit objects.
When shifting 64-bit quantities, i makes up bits 64 through 127 of the double object. The function result is
the 64-bit string beginning with bit 64-k; that is, its leftmost bit is k bits from the double object’s left end.
The value of k must be 0 ≤ k ≤ 64.
When shifting 32-bit quantities, i makes up bits 32 through 63 of the double object. The function result is
the 32-bit string beginning with bit 32-k; that is, its leftmost bit is k bits from the double object’s left end.
The value of k must be 0 ≤ k ≤ 32.
When shifting 16-bit quantities, i makes up bits 16 through 31 of the double object. The function result is
the 16-bit string beginning with bit 16-k; that is, its leftmost bit is k bits from the double object’s left end.
The value of k must be 0 ≤ k ≤ 16.
When shifting 8-bit quantities, i makes up bits 8 through 15 of the double object. The function result is the
8-bit string beginning with bit 8-k; that is, its leftmost bit is k bits from the double object’s left end. The
value of k must be 0 ≤ k ≤ 8.
Arguments are not altered in their original storage unless the result represents the same address as either i or
j, as in the Fortran assignment M = DSHIFTL(M, N, 5).
For more information on storage units, see the Fortran Language Reference Manual, Volume 3.
DSHIFTL is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
_dshiftl returns a 64-bit integer result.
DSHIFTL returns a typeless result on UNICOS and UNICOS/mk systems and an integer result on IRIX
systems. The size of the result is the size of the arguments i and j.
EXAMPLES
Fortran: The following figure shows a shift of two 64-bit quantities:
|<-- Double quanti ty shi fts lef t by k bit s
127 i 64 63 j 0
|_____ ______ ______ ___ ___ ___ _|_ ___ ___ ___ ___ ___ ___ ___ ___ __|
|----- k-----| ------ --- -re sul t-- --- --- --- |
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
Fortran Language Reference Manual, Volume 3
NAME
_dshiftr, DSHIFTR – Performs a double-object right shift
SYNOPSIS
C/C++:
#include <intrinsics.h>
long _dshiftr (long i, long j, long k);
Fortran:
DSHIFTR ([I=]i, [J=]j, [K=]k)
IMPLEMENTATION
C/C++: UNICOS and UNICOS/mk systems
Fortran: UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
The _dshiftr and DSHIFTR functions perform a double-object right shift. They return a single object.
This result is derived from two arguments, i and j. The arguments are as follows:
i The upper bits of the double object. Must be of type integer.
j The lower bits of the double object. Must be of the same type and size as i.
k The number of bits to be shifted. Must be of type integer.
The _dshiftr and DSHIFTR functions return a value generated by a right double-shift of the rightmost k
bits of i into the leftmost k bits of j. If both the i and j arguments specify the same word in memory, a
circular shift occurs. The value of k must be in the range of 0 through 64 for _dshiftr.
NOTES
C/C++
Because _dshiftr is an intrinsic function, no externally visible library function is available for it. The
compiler generates inline code to produce the result.
Fortran
On UNICOS systems, i and j are 64-bit objects. On UNICOS/mk systems, i and j can be 32- or 64-bit
objects. On IRIX systems, i and j can be 8-, 16-, 32-, or 64-bit objects.
When shifting 64-bit quantities, i makes up bits 64 through 127 of the double object. The function result is
the 64-bit string beginning with bit 64-k; that is, its rightmost bit is k bits from the double object’s right end.
The value of k must be 0 ≤ k ≤ 64.
When shifting 32-bit quantities, i makes up bits 32 through 63 of the double object. The function result is
the 32-bit string beginning with bit 32-k; that is, its rightmost bit is k bits from the double object’s right end.
The value of k must be 0 ≤ k ≤ 32.
When shifting 16-bit quantities, i makes up bits 16 through 31 of the double object. The function result is
the 16-bit string beginning with bit 16-k; that is, its rightmost bit is k bits from the double object’s right end.
The value of k must be 0 ≤ k ≤ 16.
When shifting 8-bit quantities, i makes up bits 8 through 15 of the double object. The function result is the
8-bit string beginning with bit 8-k; that is, its rightmost bit is k bits from the double object’s right end. The
value of k must be 0 ≤ k ≤ 8.
Arguments are not altered in their original storage unless the result represents the same address as either i or
j, as in the Fortran assignment M = DSHIFTR(M, N, 5).
For more information on storage units, see the Fortran Language Reference Manual, Volume 3.
DSHIFTR is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
_dshiftr returns a 64-bit integer result.
DSHIFTR returns a typeless result on UNICOS and UNICOS/mk systems and an integer result on IRIX
systems. The size of the result is the size of the arguments i and j.
EXAMPLES
The following figure shows a shift of two 64-bit quantities:
Double wor d shi fts rig ht by k bit s -->
127 i 64 63 j 0
|_____ ______ ______ ___ ___ ___ _|_ ___ ___ ___ ___ ___ ___ ___ ___ _|
|----- --- res ult --- --- --- -|- --- --- -k--- --- --|
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
Fortran Language Reference Manual, Volume 3
NAME
DSM_CHUNKSIZE, DSM_DISTRIBUTION_BLOCK, DSM_DISTRIBUTION_CYCLIC,
DSM_DISTRIBUTION_STAR, DSM_ISDISTRIBUTED, DSM_ISRESHAPED, DSM_NUMCHUNKS,
DSM_NUMTHREADS, DSM_REM_CHUNKSIZE, DSM_THIS_CHUNKSIZE, DSM_THIS_STARTINGINDEX,
DSM_THIS_THREADNUM – Query intrinsics for distributed arrays
SYNOPSIS
DSM_CHUNKSIZE ([ARRAY=]array, [DIM=]dim)
DSM_DISTRIBUTION_BLOCK ([ARRAY=]array, [DIM=]dim)
DSM_DISTRIBUTION_CYCLIC ([ARRAY=]array, [DIM=]dim)
DSM_DISTRIBUTION_STAR ([ARRAY=]array, [DIM=]dim)
DSM_ISDISTRIBUTED ([ARRAY=]array)
DSM_ISRESHAPED ([ARRAY=]array)
DSM_NUMCHUNKS ([ARRAY=]array, [DIM=]dim)
DSM_NUMTHREADS ([ARRAY=]array, [DIM=]dim)
DSM_REM_CHUNKSIZE ([ARRAY=]array, [DIM=]dim, [INDEX=]index)
DSM_THIS_CHUNKSIZE ([ARRAY=]array, [DIM=]dim, [INDEX=]index)
DSM_THIS_STARTINGINDEX ([ARRAY=]array, [DIM=]dim, [INDEX=]index)
DSM_THIS_THREADNUM ([ARRAY=]array, [DIM=]dim, [INDEX=]index)
IMPLEMENTATION
IRIX systems
MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extension
DESCRIPTION
You can use the Dynamic Shared Memory (DSM) functions to obtain information about an individual
dimension of a distributed array. All functions work with 64-bit integers.
The DSM functions are as follows:
Function Purpose
DSM_CHUNKSIZE Returns the chunk size (ignoring partial chunks) in the given dimension for each of
BLOCK, CYCLIC, and asterisk (*) distributions.
DSM_DISTRIBUTION_BLOCK
Returns 0 (FALSE) or 1 (TRUE) for a query on whether or not the specified
dimension has a BLOCK distribution.
DSM_DISTRIBUTION_CYCLIC
Returns 0 (FALSE) or 1 (TRUE) for a query on whether or not the specified
dimension has a CYCLIC distribution.
DSM_DISTRIBUTION_STAR
Returns 0 (FALSE) or 1 (TRUE) for a query on whether or not the specified
dimension has an asterisk (*) distribution.
DSM_ISDISTRIBUTED
Returns 0 (FALSE) or 1 (TRUE) for a query on whether or not array is distributed
(regular or reshaped) or not.
DSM_ISRESHAPED Returns 0 (FALSE) or 1 (TRUE) for a query on whether or not array is reshaped or
not.
DSM_NUMCHUNKS Returns the number of chunks (including partial chunks) in the given dim for each
of BLOCK, CYCLIC, and asterisk (*) distributions.
DSM_NUMTHREADS Returns the number of threads in the specified dimension of a distributed array.
DSM_REM_CHUNKSIZE
Returns the remaining chunk size from index to the end of the current chunk,
inclusive of each end point. Essentially it is the distance from index to the end of
that contiguous block, inclusive.
DSM_THIS_CHUNKSIZE
Returns the chunk size for the chunk containing the specified index for each of
BLOCK, CYCLIC, and asterisk (*). This value may be different from
DSM_CHUNKSIZE due to edge effects that can lead to a partial chunk.
DSM_THIS_STARTINGINDEX
Returns the starting index value of the chunk containing the supplied index.
DSM_THIS_THREADNUM
Returns the thread number for the chunk containing the given index value for each
of BLOCK, CYCLIC, and asterisk (*) distributions.
These functions accept the following arguments:
array An array of any data type.
dim The array dimension for which you need information. The array dimensions are numbered
starting at 1. Must be of type integer.
index Must be of type integer.
The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
The return value is of type integer. If you are using the MIPSpro 7 Fortran 90 compiler, the value is
INTEGER(KIND=8).
These functions return -1 in case of an error. For DSM_THIS_STARTINGINDEX, however, -1 can be a
valid return value.
SEE ALSO
MIPSpro 7 Fortran 90 Commands and Directives Reference Manual
mp(3F)
NAME
ENABLE_IEEE_INTERRUPT, DISABLE_IEEE_INTERRUPT – Enables or disables floating-point
interrupt
SYNOPSIS
ENABLE_IEEE_INTERRUPT ([INTERRUPT=]interrupt)
DISABLE_IEEE_INTERRUPT ([INTERRUPT=]interrupt)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The ENABLE_IEEE_INTERRUPT intrinsic subroutine enables the specified floating-point interrupt.
The DISABLE_IEEE_INTERRUPT intrinsic subroutine disables the specified floating-point interrupt.
They accept the following argument:
interrupt Must be of an integer type that occupies a full word. If interrupt is an array, it must be
1-dimensional. The single value in the scalar argument case, or each element in the array
argument case, must be set to one of the values represented by one of the following named
constants:
• IEEE_NTPT_CRI_INVALID_OPND (accepted only on Cray T90 systems that support
IEEE floating-point arithmetic)
• IEEE_NTPT_INEXACT_RESULT
• IEEE_NTPT_UNDERFLOW
• IEEE_NTPT_OVERFLOW
• IEEE_NTPT_DIV_BY_ZERO
• IEEE_NTPT_INVALID_OPR
• IEEE_NTPT_ALL (all interrupts in this list)
The IEEE_INEXACT_RESULT and IEEE_UNDERFLOW interrupts should be disabled before the execution
of any I/O statement that involves conversion to prevent arithmetic exceptions during the execution of those
I/O statements.
The name of this intrinsic cannot be passed as an argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN _IE EE_DEFINI TIO NS
CAUTIONS
Care should be taken before enabling interrupts on inexact results because inexact results are so prevalent.
In particular, inexact results will occur while performing operations which are not generally regarded as
floating-point operations. These include, but are not limited to, Fortran I/O statements, memory allocations
and DO loop iteration count computations.
RETURN VALUES
Upon return from ENABLE_IEEE_INTERRUPT, the interrupt, or each element of interrupt, is enabled. If
interrupt, or any element of interrupt, has the value IEEE_NTPT_ALL, all interrupts are enabled.
Upon return from DISABLE_IEEE_INTERRUPT, the interrupt, or each element of interrupt, is disabled. If
interrupt, or any element of interrupt, has the value IEEE_NTPT_ALL, all interrupts are disabled.
EXAMPLES
The following program can be run on UNICOS and IRIX systems:
SUBROU TIN E cal culate
USE FTN_IEEE_ DEF INITIO NS
! Save the cur rent floati ng poi nt int errupt sta tus.
! Ena ble int err upt on div ide by zer o if it has n’t alread y bee n
! ena ble d.
IF (.N OT. TES T_I EEE _IN TER RUP T(I EEE _NT PT_ DIV _BY _ZE RO)) &
CAL L ENA BLE _IE EE_ INTERR UPT (IEEE_ NTPT_D IV_BY_ ZER O)
x = y / z
CAL L DIS ABL E_I EEE _IN TER RUP T(I EEE _NT PT_ DIV _BY _ZERO) )
q = y / z
! Res tor e the flo ating poi nt int errupt sta tus to wha t it was
! whe n thi s pro ced ure was cal led .
CAL L SET _IE EE_ INT ERRUPT S(i nterru pt_sta tus)
NAME
EOSHIFT – Performs an end-off shift on an array expression
SYNOPSIS
EOSHIFT ([ARRAY=]array, [SHIFT=]shift [,[BOUNDARY=]boundary] [,[DIM=]dim])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The EOSHIFT intrinsic function performs an end-off shift on an array expression of rank one, or it performs
end-off shifts on all the complete rank one sections along a given array expression of rank two or greater.
Elements are shifted off at one end of a section and copies of a boundary value are shifted in at the other
end. Different sections can have different boundary values and can be shifted by different amounts and in
different directions; positive for left shifts, negative for right shifts.
EOSHIFT accepts the following arguments:
array May be of any type. It must not be scalar.
shift Must be integer. If array has rank one, shift must be a scalar. Otherwise, shift must be scalar
or have rank n– 1 and have shape (d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ), where (d 1 , d 2 , . . ., d n ) is
the shape of array.
boundary Must be of the same type and have the same type parameters as array. Must be scalar if array
has rank one; otherwise, it must be either scalar or of rank n– 1 and of shape
(d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ), The boundary argument can be omitted for the data types in
the following list. In these cases, the default value is the scalar value shown:
Type of array Default Value of boundary
Integer 0
Real 0.0
Complex (0.0,0.0)
Logical false
Character(len) len blanks
The boundary data type must be present for derived data types.
dim Must be a scalar. Must be an integer value in the range 1 ≤ dim ≤ n, where n is the rank of
array. If dim is omitted, the default value is 1.
EOSHIFT is a transformational intrinsic function. The name of this intrinsic cannot be passed as an
argument.
RETURN VALUES
The result is an array of the same type, type parameters, and shape as array.
Element (s 1 , s 2 , . . ., s n ) of the result has the value array(s 1 , s 2 , . . ., s dim– 1 , s dim + sh, s dim+1 , . . ., s n ), where
sh is shift or shift(s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ), provided that the inequality
LBOUND(array,dim) ≤ s dim + sh ≤ UBOUND(array,dim) holds and is otherwise boundary or
boundary(s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ).
EXAMPLES
Example 1: If V is array [1,2,3,4,5,6], the effect of shifting V end-off to the left by three positions is
achieved by EOSHIFT(V,SHIFT=3), which yields [4,5,6,0,0,0]. Specifying
EOSHIFT(V,SHIFT=-2,BOUNDARY=99) achieves an end-off shift to the right by two positions with the
boundary value of 99 and yields [99,99,1,2,3,4].
Example 2: The rows of an array of rank two can all be shifted by the same amount or by different amounts
and the boundary elements can be the same or different. Assume that M is the following array:
| A B C |
| D E F |
| G H I |
EOSHIFT(M,SHIFT=-1,BOUNDARY=’*’,DIM=2) yields:
| * A B |
| * D E |
| * G H |
EOSHIFT(M,SHIFT=(/-1,1,0/),BOUNDARY=(/’*’,’/’,’?’/),DIM=2) yields:
| * A B |
| E F / |
| G H I |
NAME
EPSILON – Returns r-1, where r is the smallest number greater than 1 in the numeric model
SYNOPSIS
EPSILON ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The EPSILON intrinsic function returns a positive model number that is almost negligible compared to unity
in the model representing numbers of the same type and kind type parameter as the argument. It accepts the
following argument:
x Must be of type real. It can be scalar or array valued.
EPSILON is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
(1-p)
The result type is a scalar of the same type and kind type parameter as x. The result has the value b
where b and p are as defined in the model for real numbers representing numbers of the same type and kind
type parameter as x. For information on the real number model, see the MODELS(3I) man page.
EXAMPLES
The following code fragment was run on several systems:
REA L(KIND =4) r4
REA L(KIND =8) r8
REAL(K IND=16 ) r16
REAL rd
PRINT *,’EPS ILO N r4= ’,EPSI LON (r4 )
PRINT *,’EPS ILO N r8= ’,E PSI LON (r8 )
PRINT *,’EPS ILO N r16 =’,EPS ILO N(r 16)
PRINT *,’EPS ILO N rd= ’,E PSI LON (rd )
END
The results of this test case on Cray T90 systems that support IEEE floating-point arithmetic are as follows:
EPS ILO N r4= 1.1920 928 96E-7
EPS ILO N r8= 2.2204 460 492503130 8E- 16
EPS ILO N r16 = 1.9 259299443 872 358 530559 779 425 849273 2E- 34
EPS ILO N rd= 2.2204 460 492503130 8E- 16
The results of this test case on UNICOS systems, except for Cray T90 systems that support IEEE
floating-point arithmetic, are as follows:
EPS ILO N r4= 1.1 920 928955 078 12E -7
EPS ILO N r8= 1.4 210 854715 202 E-1 4
EPS ILO N r16= 5.0487 097 934144 755 546 350 628178 1E- 29
EPS ILO N rd= 1.4210854 715 202 E-14
SEE ALSO
MODELS(3I)
NAME
EQV, NEQV, XOR – Computes logical equivalence or difference
SYNOPSIS
EQV ([I=]i,[J=]j)
NEQV ([I=]i,[J=]j)
XOR ([I=]i,[J=]j)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extensions
DESCRIPTION
EQV computes a logical equivalence. This function is not accepted by the MIPSpro Fortran 77 compiler.
NEQV and XOR are two names for the same routine. These functions compute a logical difference. NEQV is
not accepted by the MIPSpro Fortran 77 compiler.
These functions accept the following arguments:
i Must be of type Boolean, integer, real, logical, or Cray pointer.
j Must be of type Boolean, integer, real, logical, or Cray pointer. For EQV, j need not be the
same type as i, but j must be the same size as i.
These are elemental functions. The names of these intrinsics cannot be passed as arguments.
NOTES
These routines are outmoded. Refer to the Fortran Language Reference Manual, Volume 3, for information
about outmoded features and their preferred standard alternatives.
CAUTIONS
Unexpected results can occur when Boolean functions are declared external and then used with logical
arguments. The external Boolean functions always treat their arguments as type Boolean and return a
Boolean result on UNICOS and UNICOS/mk systems. On IRIX systems, they return an integer result.
RETURN VALUES
EQV, when given two arguments of type Boolean, real, integer, or pointer, computes a bit-wise logical
equivalence and returns a Boolean (on UNICOS and UNICOS/mk systems) or integer (on IRIX systems)
result. When both i and j are of type logical, the result is of type logical. The following tables show both
the logical equivalence and bit-wise logical equivalence:
T T T
T F F
F T F
F F T
1 1 1
1 0 0
0 1 0
0 0 1
NEQV and XOR, when given two arguments of type logical, compute a logical difference and return a logical
result. When given two arguments of type Boolean, integer, real, or pointer, NEQV and XOR compute a
bit-wise logical difference and return a Boolean result. The following tables show both the logical difference
and bit-wise logical difference. NEQV is shown in the tables, but XOR produces identical results.
T T F
T F T
F T T
F F F
1 1 0
1 0 1
0 1 1
0 0 0
EXAMPLES
Example 1. The following section of Fortran code shows the EQV function used with two arguments of type
logical:
LOG ICAL L1, L2, L3
...
L3 = EQV(L1 ,L2 )
Example 2. The following section of Fortran code shows the EQV function used with two arguments of type
integer. The bit patterns of the arguments and result are also given. For clarity, only the rightmost 8 bits
are shown.
INT EGER I1, I2, I3
I1 = 12
I2 = 10
...
I3 = EQV(I1 ,I2)
------ ------ --- --- --- --- --- --- - --- --- --- --- --- --- --- --- --- ----
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 |
------ ------ --- --- --- --- --- --- - --- --- --- --- --- --- --- --- --- ----
I1 I2
--- --- --- --- --- --- --- --- --- --- -
| 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |
--- --- --- --- --- --- --- --- --- --- -
I3
Example 3. The following section of Fortran code shows the NEQV function used with two arguments of
type logical. XOR is used in the same manner and produces the same results.
LOG ICAL L1, L2, L3
...
L3 = NEQV(L 1,L 2)
Example 4. The following section of Fortran code shows the NEQV function used with two arguments of
type integer. XOR is used in the same manner and produces the same results. The bit patterns of the
arguments and results are also given. For clarity, only the rightmost 8 bits are shown.
NAME
_EX – Performs a normal exit
SYNOPSIS
#include <intrinsics.h>
UNICOS systems except Cray T90:
void _EX (void);
Cray T90:
void _EX (int n);
IMPLEMENTATION
UNICOS systems
STANDARDS
C/C++ extension
DESCRIPTION
The _EX function performs a normal exit to the address in the exit address register (EAn).
On all UNICOS and UNICOS/mk systems except Cray T90, _EX does not take an argument; n is assumed
to be zero. On the Cray T90, _EX accepts the following variable:
n An integer constant in the range of 0 through 4. If n is in the range of 5 through 7, the function
performs an exit to the exchange address register (XA).
NOTES
Because _EX is an intrinsic function, no externally visible library function is available for it. The compiler
generates inline code to produce the result.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
EXP, DEXP, QEXP, CEXP, CDEXP, CQEXP – Computes exponential function
SYNOPSIS
EXP ([X=]x)
DEXP ([X=]x)
QEXP ([X=]x)
CEXP ([X=]x)
CDEXP ([X=]x)
CQEXP ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QEXP, CDEXP, CQEXP
DESCRIPTION
EXP is the generic function name; the others are specifics. These are elemental intrinsic functions. They
accept the following argument:
x Must be of type real (for EXP, DEXP, and QEXP) or complex (for CEXP, CDEXP, and CQEXP).
The type and kind type of x is identical to the type and kind type of the return value. See the
RETURN VALUES section for information on input data types and return values.
Vector versions of these intrinsics exist on some systems. Vector versions of the EXP, DEXP, CEXP,
CDEXP, and CQEXP intrinsic functions exist on UNICOS and UNICOS/mk systems. On UNICOS/mk
systems, the vector versions of these intrinsics are used when -O vector3 or -O 3 are specified on the
compiler command line. A vector version of the single-precision and double-precision EXP intrinsic exists
on IRIX systems and is used when -O3 is specified on the compiler command line.
x
These functions evaluate y = e .
NOTES
The EXP, DEXP, and CEXP intrinsic function names can be passed as arguments; the others cannot.
On Cray T90 systems that support IEEE floating-point arithmetic, the following return values occur:
• If x < – 708.4, EXP(x) yields 0.
• If x > 709.78, EXP(x) yields infinity.
NAME
EXPONENT – Returns the exponent part of the argument when represented as a numeric model number
SYNOPSIS
EXPONENT ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The EXPONENT intrinsic function returns the exponent part of the argument when represented as a numeric
model number. It accepts the following argument:
x Must be of type real
EXPONENT is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type is default integer. The result has a value equal to the exponent, e, of the real number model
for the value of x, provided that x is nonzero and e is within the range for default integers. For more
information on the real number model, see the MODELS(3I) man page.
The result is undefined if the machine upon which the compiler is running cannot represent e in the default
integer type.
EXAMPLES
EXPONENT(1.0) yields 1.
EXPONENT(4.1) yields 3.
If X = 0, EXPONENT(X) yields 0.
SEE ALSO
MODELS(3I)
NAME
FCD – Constructs a Cray character pointer in Fortran character Descriptor (FCD) format
SYNOPSIS
FCD ([I=]i, [J=]j)
IMPLEMENTATION
UNICOS, UNICOS/mk systems
CF90
STANDARDS
Fortran extension
DESCRIPTION
The FCD intrinsic function constructs a Cray character pointer in FCD format. This function accepts the
following arguments:
i Must be of type integer (KIND=8) or Cray pointer and represent the word address for the
pointee’s first character.
j Must be an integer (KIND=8) value that represents the pointee’s character length.
FCD is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The value returned is of type Cray pointer.
EXAMPLES
As the following example shows, you can add an offset even if the Cray character pointee does not start on a
word boundary.
CPT R = FCD(IA DRS , ILE N) + IOF FSE T
SEE ALSO
CLOC(3I)
NAME
FLOOR – Returns the greatest integer less than or equal to a
SYNOPSIS
FLOOR ([A=]a [,[KIND=]kind])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The FLOOR intrinsic function returns the greatest integer less than or equal to a. It accepts the following
arguments:
a Must be of type real
kind An integer scalar value. Must be a scalar integer initialization expression
FLOOR is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is an integer. If kind is specified, the kind type parameter is that specified by kind. If kind is not
specified, the result is of type default integer. The result has value equal to the greatest integer less than or
equal to a. The result is undefined if the target machine cannot represent this value in the default integer
type.
EXAMPLES
FLOOR(3.7) yields 3.
FLOOR(-3.7) yields -4.
SEE ALSO
CF90 Commands and Directives Reference Manual
NAME
FRACTION – Returns the fractional part of the numeric model representation of the argument value
SYNOPSIS
FRACTION ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The FRACTION intrinsic function returns the fractional part of the numeric model representation of the
argument value. It accepts the following argument:
x Must be of type real
FRACTION is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
-e
The result type and type parameter are that of x. The result has the value x multiplied by b , where b and e
are as defined in the real number system model. For more information on the real number system model,
see the MODELS(3I) man page.
If x has the value zero, the result has the value zero.
EXAMPLES
FRACTION(3.0) yields 0.75 for reals.
SEE ALSO
MODELS(3I)
NAME
_gbit, _gbits – Returns the value of the nth bit (from the right)
SYNOPSIS
#include <intrinsics.h>
long _gbit (long x, long n);
long _gbits (long x, long m, long n);
IMPLEMENTATION
UNICOS, UNICOS/mk systems
STANDARDS
C/C++ extension
DESCRIPTION
The _gbit function returns the value of the nth bit (from the right) of data word x.
The _gbits function returns a value consisting of m bits extracted from x, starting at bit position n (from
the right and counting to the left); the returned bits are right-justified.
These functions accept the following variables:
x The data word from which the value is extracted.
m A value in the range of 0 through 63.
n A value in the range of 0 through 63.
NOTES
Because _gbit and _gbits are intrinsic functions, no externally visible library functions are available for
them. The compiler generates inline code to produce the result.
EXAMPLES
Program source:
main()
{
lon g x = 0x1 234 567 890 abc def ;
Execution output:
_gb it( x, 19) = 1
_gb its (x, 8, 12) = bc
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
GET_IEEE_EXCEPTIONS – Retrieves flags that represent the current floating-point exception status
SYNOPSIS
GET_IEEE_EXCEPTIONS ([STATUS=]status)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The GET_IEEE_EXCEPTIONS intrinsic subroutine is typically called upon entry to a procedure to obtain a
set of flags that represent the current floating-point exception status. It accepts the following argument:
status Must be scalar and of an integer type that occupies a full word. It is an INTENT(OUT)
argument.
The exceptions that are possible are as follows:
• IEEE_XPTN_CRI_INVALID_OPND (accepted only on Cray T90 systems that support IEEE floating-
point arithmetic)
• IEEE_XPTN_INEXACT_RESULT
• IEEE_XPTN_UNDERFLOW
• IEEE_XPTN_OVERFLOW
• IEEE_XPTN_DIV_BY_ZERO
• IEEE_XPTN_INVALID_OPR
• IEEE_XPTN_ALL (all exceptions in this list)
This subroutine increases program performance by capturing and then directly manipulating the status bits
with bit manipulation operations. This practice compromises portability, however.
The name of this intrinsic cannot be passed as an argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN _IEEE_ DEF INI TIO NS
RETURN VALUES
The value returned in status is the set of bits that represent the current floating-point exception state.
To determine the exceptions that have been raised, use TEST_IEEE_EXCEPTION(3I).
EXAMPLES
See the example on CLEAR_IEEE_EXCEPTION(3I).
SEE ALSO
CLEAR_IEEE_EXCEPTION(3I), SET_IEEE_EXCEPTION(3I), TEST_IEEE_EXCEPTION(3I)
NAME
GET_IEEE_INTERRUPTS – Retrieves flags that represent the current floating-point interrupt status
SYNOPSIS
GET_IEEE_INTERRUPTS ([STATUS=]status)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The GET_IEEE_INTERRUPTS intrinsic subroutine is typically called upon entry to a procedure to obtain a
set of flags that represent the current floating-point interrupt status. It accepts the following argument:
status Must be scalar and of an integer type that occupies a full word. It is an INTENT(OUT)
argument.
For the names of all possible interrupts, see GET_IEEE_STATUS(3I).
This subroutine increases program performance by capturing and then directly manipulating the status bits
with bit manipulation operations. This practice compromises portability, however.
The name of this intrinsic cannot be passed as an argument.
Some of the bits of status are set to indicate the floating-point interrupts that are currently enabled or
currently disabled. The state of any given interrupt can be determined using TEST_IEEE_INTERRUPT(3I)
and can be altered using ENABLE_IEEE_INTERRUPT(3I) or DISABLE_IEEE_INTERRUPT(3I).
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN_IE EE_DEF INI TIO NS
EXAMPLES
See the example on DISABLE_IEEE_INTERRUPT(3I).
SEE ALSO
DISABLE_IEEE_INTERRUPT(3I), ENABLE_IEEE_INTERRUPT(3I), GET_IEEE_STATUS(3I),
TEST_IEEE_INTERRUPT(3I)
NAME
GET_IEEE_ROUNDING_MODE – Returns current floating-point rounding mode
SYNOPSIS
GET_IEEE_ROUNDING_MODE ([STATUS=]status)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The GET_IEEE_ROUNDING_MODE intrinsic subroutine is typically called upon entry to a procedure to
obtain the current floating-point rounding mode. It accepts the following argument:
status Must be scalar and of an integer type that occupies a full word. It is an INTENT(OUT)
argument.
This subroutine increases program performance by capturing and then directly manipulating the status bits
with bit manipulation operations. This practice compromises portability, however.
The name of this intrinsic cannot be passed as an argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN_IE EE_DEF INI TIO NS
RETURN VALUES
status is set to one of the following values. These named constants indicate the possible floating-point
rounding modes.
• IEEE_RM_NEAREST
• IEEE_RM_POS_INFINITY
• IEEE_RM_ZERO
• IEEE_RM_NEG_INFINITY
EXAMPLES
See the example on SET_IEEE_ROUNDING_MODE(3I).
SEE ALSO
SET_IEEE_ROUNDING_MODE(3I)
NAME
GET_IEEE_STATUS – Retrieves flags that represent the current floating-point status upon entry to a
procedure
SYNOPSIS
GET_IEEE_STATUS ([STATUS=]status)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The GET_IEEE_STATUS intrinsic subroutine is typically used to obtain all flags that represent the current
floating-point status upon entry to a procedure. The value returned is often used as the argument to
SET_IEEE_STATUS(3I) to restore the IEEE status to what it was upon entry to the procedure.
GET_IEEE_STATUS accepts the following argument:
status Must be scalar and of an integer type that occupies a full word. For example, on IRIX systems,
its kind type parameter must be 4, and on UNICOS/mk systems, its kind type parameter must be
8. It is an INTENT(OUT) argument.
The IEEE exceptions are as follows:
• IEEE_XPTN_CRI_INVALID_OPND (accepted only on Cray T90 systems that support IEEE floating-
point arithmetic)
• IEEE_XPTN_INEXACT_RESULT
• IEEE_XPTN_UNDERFLOW
• IEEE_XPTN_OVERFLOW
• IEEE_XPTN_DIV_BY_ZERO
• IEEE_XPTN_INVALID_OPR
• IEEE_XPTN_ALL (all exceptions in this list)
The IEEE interrupts are as follows:
• IEEE_NTPT_CRI_INVALID_OPND (valid only on Cray T90 systems that support IEEE floating-point
arithmetic)
• IEEE_NTPT_INEXACT_RESULT
• IEEE_NTPT_UNDERFLOW
• IEEE_NTPT_OVERFLOW
• IEEE_NTPT_DIV_BY_ZERO
• IEEE_NTPT_INVALID_OPR
• IEEE_NTPT_ALL
This subroutine increases program performance by capturing and then directly manipulating the status bits
with bit manipulation operations. This practice compromises portability, however.
The name of this intrinsic cannot be passed as an argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN _IE EE_DEFINI TIO NS
RETURN VALUES
On Cray T90 systems that support IEEE floating-point arithmetic, the value of status is the content of SR0 (a
64-bit word).
On all other architectures, the value of status is a set of bits that represent the current floating-point state.
There is no requirement that the state is represented by the machine as a single word. That is, this procedure
may have to acquire the flags from several locations and combine them into a single word.
EXAMPLES
See example on SET_IEEE_STATUS(3I).
SEE ALSO
SET_IEEE_STATUS(3I)
NAME
GETPOS, SETPOS – Obtains a file position or returns a file to a previous position
SYNOPSIS
For tape or disk files:
CALL GETPOS(i, len, pa [,stat])
CALL SETPOS(i, len, pa [,stat])
For disk files only:
CALL GETPOS(i, pv)
GETPOS ([I=]i) (intrinsic function syntax)
CALL SETPOS(i, pv)
IMPLEMENTATION
UNICOS, UNICOS/mk systems
CF90
STANDARDS
Fortran extension
DESCRIPTION
GETPOS and SETPOS are used in input/output (I/O) operations. GETPOS can be used as either an intrinsic
function or as a library routine. SETPOS can be used only as a library routine.
GETPOS returns the current position of the specified tape or mass storage file to the Fortran user. GETPOS
does not alter the file’s position, but it captures information that you can use later to recover the current
position.
As an intrinsic function, GETPOS obtains a file position and returns the current record number. In Fortran
95, it is an elemental function. The name of this intrinsic cannot be passed as an argument.
SETPOS changes the current position within a file. Unblocked files can be positioned to any word offset in
the file, with a position of 0 being the beginning of the file. For other files, SETPOS lets you return to the
position retained from the GETPOS request.
GETPOS and SETPOS can be used only on sequential files. They accept the following arguments:
i Unit number. Must be an integer or Boolean value in the range 1 ≤ i ≤ 299.
If i is an integer, i must be of KIND=8.
len Length in Cray words of the position array. len can be an integer, variable, expression, or
constant. If i is an integer, i must be of KIND=8.
This parameter determines the maximum number of position values to return or process. For
SETPOS, this parameter allows for the addition of more information fields while ensuring that
existing codes continue to run. Possible values for len are as follows:
• 1 for disk files
• 2 for tape files
• 4 for files assigned with -F er90
• 6 for files assigned with -F cos,er90. For ER90 files, the information returned does not
include the Volume Serial Number (VSN) or partition information. Before issuing a
SETPOS, verify that the correct VSN and partition is in position.
pa and pv Position array or position value. On exit, pa contains the current position information. For
GETPOS, you should not modify this information. It should be retained to be passed on to
SETPOS. For SETPOS, pa contains the desired position information from the GETPOS call.
The format of the position information is as follows:
• For a disk file, 1 word that contains the current position.
• If the file is assigned as cos, u, sbin, syscall, mr, or sds through the -s or -F options
to the assign(1) command, a position value of – 1 is supported. A value of – 1 positions
the file at the end. If the file is not terminated by a physical endfile record, the file is
positioned just prior to a logical endfile record. Otherwise the file is positioned after all data
and endfile records. A value of – 2 positions the file just prior to the last endfile record. All
sequential files have a physical or logical endfile record as the last record of the file.
• For a tape file, 2 words; word 0 contains the volume serial number of the current tape reel,
and word 1 contains the block number before which the tape unit is positioned.
• For an ER90 file, the words returned contain device-specific information.
stat Return conditions. This can be either a zero or a nonzero value, which indicates the following:
• A zero value indicates that either the position information was obtained successfully
(GETPOS) or that the file was positioned successfully (SETPOS).
• A nonzero value indicates that an error or warning was encountered during the request.
To set the position of a disk file, the position can be anywhere within the file if the file is not blocked. If
the file is a COS blocked file, the position must be at a record boundary; that is, at the beginning-of-data
(BOD), following an end-of-record (EOR) or end-of-file (EOF), or before an end-of-data (EOD). A file
cannot be positioned beyond the current EOD.
GETPOS and SETPOS support the COS-blocked file format, but they do not support any other type of
blocked file format. On UNICOS systems, they support tape and ER90 formats.
RETURN VALUES
When used as an intrinsic function, the return value of GETPOS is of type Boolean.
When referenced as an external subprogram, the return value of GETPOS is an INTEGER(KIND=8) value.
NOTES
For unblocked or pure data files, the position returned by GETPOS is the current word offset within the file.
SEE ALSO
GETTP(3F), SETTP(3F)
UNICOS File Formats and Special Files Reference Manual, for a description of the Fortran blocked file
structure, including examples of EOR, EOF, and EOD
NAME
_getvm, _setvm – Returns contents of or sets vector mask register
SYNOPSIS
#include <intrinsics.h>
long _getvm (void);
void _setvm (long x);
IMPLEMENTATION
UNICOS systems
STANDARDS
C/C++ extension
DESCRIPTION
The _getvm function returns the contents of the vector mask register.
The _setvm function sets the vector mask register to the value in data word x.
NOTES
Because _getvm and _setvm are intrinsic functions, no externally visible library functions are available
for them. The compiler generates inline code to produce the result.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
HUGE – Returns the largest number in the integer or real numeric model
SYNOPSIS
HUGE ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The HUGE intrinsic function returns the largest number in the model representing numbers of the same type
and kind type parameter as the argument x. It accepts the following argument:
x Must be of type integer or real. It may be scalar or array valued.
HUGE is an inquiry function. The name of this intrinsic cannot be passed as an argument.
NOTES
On UNICOS systems, both execution speed and the number of bits used in mathematical operations are
affected when compiling with f90 -O fastint, which is the default setting. For more information, see
CF90 Commands and Directives Reference Manual.
RETURN VALUES
q
The result is a scalar value of the same type and kind type parameter as x. The result has the value r – 1 if
-p e sub max
x is of type integer and the value (1-b ) multiplied by b if x is of type real, where r, q, b, p, and
e max (represented as "e sub max" in the previous equation) are as defined in the real number model, which
represents numbers of the same type and kind type parameter as x. For more information on the real number
model, see the MODELS(3I) man page.
EXAMPLES
– 47 8189
On UNICOS systems, HUGE(X) has a value that approximates (1– 2 ) multiplied by 2 for real X.
On Cray T90 systems that support IEEE floating-point arithmetic, HUGE(X) has values that approximate the
following:
• (1-2 -24 ) multiplied by 2 128 for real (KIND=4) X
• (1-2 -53 ) multiplied by 2 1024 for real (KIND=8) X
NAME
IAND, IIAND, JIAND, KIAND, IEOR, IIEOR, JIEOR, KIEOR, IOR, IIOR, JIOR, KIOR – Performs a
logical AND, an exclusive OR, or an inclusive OR
SYNOPSIS
IAND ([I=]i, [J=]j)
IIAND ([I=]i, [J=]j)
JIAND ([I=]i, [J=]j)
KIAND ([I=]i, [J=]j)
IEOR ([I=]i, [J=]j)
IIEOR ([I=]i, [J=]j)
JIEOR ([I=]i, [J=]j)
KIEOR ([I=]i, [J=]j)
IOR ([I=]i, [J=]j)
IIOR ([I=]i, [J=]j)
JIOR ([I=]i, [J=]j)
KIOR ([I=]i, [J=]j)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: IIAND, JIAND, KIAND, IIEOR, JIEOR, KIEOR, IIOR, JIOR, KIOR
DESCRIPTION
The IAND, IIAND, JIAND, and KIAND intrinsic functions perform a logical AND.
The IEOR, IIEOR, JIEOR, and KIEOR intrinsic functions perform an exclusive OR.
The IOR, IIOR, JIOR, and KIOR intrinsic functions perform an inclusive OR.
They accept the following arguments:
RETURN VALUES
The result type and type parameter are the same as i. On IRIX systems, the result can be affected by the -i
option on the f90(1) command line.
For IAND, IIAND, JIAND, and KIAND, the result has the value obtained by combining i and j bit-by-bit
according to the following truth table:
i j IAND (i, j)
1 1 1
1 0 0
0 1 0
0 0 0
For IEOR, IIEOR, JIEOR, and KIEOR, the result has the value obtained by combining i and j bit-by-bit
according to the following truth table:
i j IEOR (i, j)
1 1 0
1 0 1
0 1 1
0 0 0
For IOR, IIOR, JIOR, and KIOR, the result has the value obtained by combining i and j bit-by-bit
according to the following truth table:
i j IOR (i, j)
1 1 1
1 0 1
0 1 1
0 0 0
The bit model defines the interpretation of an integer value as a sequence of bits. For more information on
the bit model, see the MODELS(3I) man page.
EXAMPLES
Example 1. IAND(1,3) yields 1.
Example 2. IEOR(1,3) yields 2.
Example 3. IOR (1,3) yields 3.
SEE ALSO
f90(1)
MODELS(3I)
NAME
IBCHNG, IIBCHNG, JIBCHNG, KIBCHNG, IBCLR, IIBCLR, JIBCLR, KIBCLR, IBSET, IIBSET,
JIBSET, KIBSET – Sets, clears, or reverses the value of a specified bit in an integer
SYNOPSIS
IBCHNG ([I=]i, [POS=]pos)
IIBCHNG ([I=]i, [POS=]pos)
JIBCHNG ([I=]i, [POS=]pos)
KIBCHNG ([I=]i, [POS=]pos)
IBCLR ([I=]i, [POS=]pos)
IIBCLR ([I=]i, [POS=]pos)
JIBCLR ([I=]i, [POS=]pos)
KIBCLR ([I=]i, [POS=]pos)
IBSET ([I=]i, [POS=]pos)
IIBSET ([I=]i, [POS=]pos)
JIBSET ([I=]i, [POS=]pos)
KIBSET ([I=]i, [POS=]pos)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: IBCHNG, IIBCHNG, JIBCHNG, KIBCHNG, IIBCLR, JIBCLR, KIBCLR, IIBSET,
JIBSET, KIBSET
DESCRIPTION
The IBCHNG, IIBCHNG, JIBCHNG, and KIBCHNG intrinsic functions reverse the value of a specified bit in
an integer.
The IBCLR, IIBCLR, JIBCLR, and KIBCLR intrinsic functions clear one bit to zero.
The IBSET, IIBSET, JIBSET, and KIBSET intrinsic functions set one bit to 1.
They accept the following arguments:
RETURN VALUES
For IBCHNG, IIBCHNG, JIBCHNG, and KIBCHNG, the result type and type parameter are the same as i.
The result is equal to i, with the bit in position pos reversed.
For IBCLR, IIBCLR, JIBCLR, and KIBCLR, The result type and type parameter are the same as i. The
result has the value of the sequence of bits of i, except that bit pos of i is set to zero.
For IBSET, IIBSET, JIBSET, KIBSET, The result type and type parameter are the same as i. The result
has the value of the sequence of bits of i, except that bit pos of i is set to one.
The bit model defines the interpretation of an integer value as a sequence of bits. For more information on
the bit model, see the MODELS(3I) man page.
EXAMPLES
Example 1. IBCLR(14,1) yields 12.
Example 2. If V has the value [1,2,3,4], IBCLR(POS=V,I=31) yields [29,27,23,15].
Example 3. IBSET(12,1) yields 14.
Example 4. If V has the value [1,2,3,4], IBSET(POS=V,I=0) yields [2,4,8,16].
SEE ALSO
MODELS(3I)
NAME
IBITS, IIBITS, JIBITS, KIBITS – Extracts a sequence of bits
SYNOPSIS
IBITS ([I=]i, [POS=]pos, [LEN=]len)
IIBITS ([I=]i, [POS=]pos, [LEN=]len)
JIBITS ([I=]i, [POS=]pos, [LEN=]len)
KIBITS ([I=]i, [POS=]pos, [LEN=]len)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: IIBITS, JIBITS, KIBITS
DESCRIPTION
The IBITS, IIBITS, JIBITS, and KIBITS intrinsic functions extract a sequence of bits. They accept the
following arguments:
i Must be of type integer. For IIBITS, must be of type integer (KIND=2). For JIBITS, must
be of type integer (KIND=4). For KIBITS, must be of type integer (KIND=8).
pos Must be of type integer. It must be nonnegative and pos + len must be less than or equal to
BIT_SIZE (i).
len Must be of type integer and nonnegative.
These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
The result type and type parameter are the same as i. The result has the value of the sequence of len bits in
i beginning at bit pos right-adjusted and with all other bits zero.
The bit model defines the model for the interpretation of an integer value as a sequence of bits. For more
information on the bit model, see the MODELS(3I) man page.
EXAMPLES
IBITS(14,1,3) yields 7. In this example, the bits are numbered from right to left, so they are extracted
from right to left.
SEE ALSO
MODELS(3I)
NAME
IDATE, ITIME – Returns date or time in numerical form
SYNOPSIS
CF90 and MIPSpro 7 Fortran 90:
CALL IDATE ([I=]month, [J=]day, [K=]year)
MIPSpro 7 Fortran 77:
CALL ITIME iarray
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Extensions
DESCRIPTION
IDATE intrinsic subroutine returns the current date in the variables day, month, and year, in that order.
month is in the range 1-12; year is returned as the last two digits.
ITIME returns the current time in iarray, in hours, minutes, seconds, in that order.
SEE ALSO
NAME
IEEE_BINARY_SCALE – Returns y multiplied by 2**n
SYNOPSIS
IEEE_BINARY_SCALE ([Y=]y, [N=]n)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
n
The IEEE_BINARY_SCALE intrinsic function returns y multiplied by the value 2 for integral values n
n
without computing 2 .
This function accepts the following arguments:
y Must be of type real.
n Must be of type integer. If y is scalar, n must be scalar. If y is an array, n can be a scalar or an
array of the same shape as x.
IEEE_BINARY_SCALE is an elemental function. The name of this intrinsic cannot be passed as an
argument.
RETURN VALUES
The return value is of the same type and type parameter as y. If y is an array, the result is an array of the
same shape as y.
n
If y is scalar, the result is a scalar that has the value of y multiplied by 2 .
If y is an array and n is scalar, the result is an array in which the value of each element is the product of y i
n
and the value 2 .
If y is an array and n is an array, the result is an array in which the value of each element is the product of
y i and the value 2**n i .
EXAMPLES
NAME
IEEE_CLASS – Returns the class to which x belongs
SYNOPSIS
IEEE_CLASS ([X=]x)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
A floating-point number can be classified several ways, such as a quiet NaN, a signaling NaN, -0, +inf, etc.
The IEEE_CLASS intrinsic function returns a value that indicates the class to which x belongs.
This function accepts the following argument:
x Must be of type real.
IEEE_CLASS is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN_IE EE_DEF INI TIO NS
RETURN VALUES
The result type and type parameter is default integer. If x is an array, the result is an array of the same
shape as x.
The value returned has a value represented by one of the following named constants:
EXAMPLES
REA L x
... ! Com put e X.
SEL ECT CASE (IEEE_ CLASS( x))
CAS E IEE E_CLASS_S IGN ALI NG_ NAN
... ! Do som ething .
CASE IEEE_C LAS S_QUIET_N AN
... ! Do som ething els e.
... ! Oth er cas es.
END SEL ECT
NAME
IEEE_COPY_SIGN – Returns x with the sign of y
SYNOPSIS
IEEE_COPY_SIGN ([X=]x, [Y=]y)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_COPY_SIGN intrinsic function returns x with the sign of y. For example,
ABS(x) = IEEE_COPY_SIGN(x, 1.0) even if x is a NaN.
The Fortran 95 standard SIGN(3I) intrinsic function produces the same result as IEEE_COPY_SIGN on
systems that support IEEE floating-point arithmetic.
This function accepts the following arguments:
x Must be of type real.
y Must be of type real. If x is a scalar, y must be a scalar. If x is an array, y can be scalar or an
array of the same shape as x.
IEEE_COPY_SIGN is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The return value is of the same type and type parameter as x. If x is an array, the result is an array of the
same shape as x.
If x is scalar, the result is a scalar that has the same value as x but with the sign of y.
If x is an array and y is scalar, the result is an array in which each element has the value of the
corresponding element of x and the sign of y.
If x is an array and y is an array, the result is an array in which each element has the value of x i but the sign
of y i .
EXAMPLES
Example 1. Each element of x now has its original value but with the sign of each corresponding element of
y:
REA L x(1 0), y(1 0)
... ! Com put e X and Y.
x = IEE E_COPY _SI GN( x, y)
Example 2. The following PRINT statement is executed on a system that supports the IEEE standard for
floating-point arithmetic:
PRINT *, ’IE EE_ COP Y_S IGN (5. 0,- 0.0 )
SEE ALSO
SIGN(3I)
NAME
IEEE_EXPONENT – Returns the unbiased exponent of x
SYNOPSIS
IEEE_EXPONENT ([X=]x[, [Y=]y])
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_EXPONENT intrinsic function returns the unbiased exponent of x. This function corresponds to
the logb function described in the IEEE standard appendix of recommended functions.
The IEEE_EXPONENT function accepts the following arguments:
x Must be of type real. Can be a scalar or array value.
y Can be of type integer or real. Must be a scalar value.
IEEE_EXPONENT is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is the value of the unbiased exponent of x.
If y is absent and x is +inf, -inf, or NaN, the result is HUGE(0). If x is 0.0, the result is -HUGE(0).
If y is present and of type integer and x is +inf, -inf, or NaN, the result is HUGE(y). If x is 0.0, the result
is -HUGE(y).
If y is present and of type real, the value is an integral value in floating-point format. If x is a NaN, the
result is a NaN. If x is +inf or -inf, the result is +inf. If x is 0.0, the result is -inf and the division by zero
exception is raised.
When x is positive and finite, the expression IEEE_BINARY_SCALE(X,-IEEE_EXPONENT(X)) lies
strictly between 0 and 2; it is less than 1 only when x is denormalized.
EXAMPLES
Example 1.
REA L x
... ! Com put e X.
PRI NT *, "Unbia sed expone nt of X:", IEEE_E XPONEN T(x)
The PRINT statement prints the unbiased exponent of x as a default integer value as long as x is not one of
the exceptional values noted in the RETURN VALUES section.
Example 2. Program ieexp.f90 uses several intrinsic procedures:
REA L(8 ) X
NAME
IEEE_FINITE – Tests for x being greater than negative infinity and less than positive infinity.
SYNOPSIS
IEEE_FINITE ([X=]x)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_FINITE intrinsic function returns the value TRUE if -inf < x < +inf. Otherwise, it returns the
value FALSE. IEEE_FINITE accepts the following argument:
x Must be of type real.
IEEE_FINITE is an elemental function. The name of this intrinsic cannot be passed as an argment.
RETURN VALUES
The result type and type parameter is default logical. If x is an array, the result is an array of the same
shape as x.
EXAMPLES
REA L x
... ! Com put e X.
IF (IE EE_FIN ITE (x) ) THE N
... ! Do som eth ing .
ELS E
... ! Do som eth ing els e.
END IF
NAME
IEEE_INT – Converts x to an integral value
SYNOPSIS
IEEE_INT ([X=]x [, [Y=]y])
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_INT intrinsic function converts x to an integral value according to the rounding mode currently
in effect. It accepts the following arguments:
x Must be of type real. It can be scalar or an array.
y If specified, must be scalar and of type integer or real.
IEEE_INT is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type and type parameters are as follows. If y is absent, the result type and type parameter is
default integer. If y is present, the result type and type parameter is the same type and type parameter as y.
If x is an array, the result is an array of the same shape as x. A conversion between a floating-point integral
value and an integer is exact unless an exception arises.
If y is absent, the result is a default integer rounded from x according to the rounding mode currently in
effect.
If y is present and is of type integer, the result is of type integer with the same kind type parameter value as
y and whose value is rounded from x according to the rounding mode currently in effect.
If y is present and is of type real, the result is of type real with the same kind type parameter value as y and
whose value is rounded from x according to the rounding mode currently in effect. If the rounding mode is
round-to-nearest and the difference between the unrounded value of x and the rounded result of IEEE_INT
is exacty one half, the result of IEEE_INT is even.
EXAMPLES
REA L x
...
PRI NT *, IEE E_INT(x, 1)
PRI NT *, IEEE_INT( x, 1.0 )
If x had the value 4.1, the result of the first invocation of IEEE_INT would be integer value 4 and the
second result would be the real value 4.0.
NAME
IEEE_IS_NAN, ISNAN – Tests for x being a NaN
SYNOPSIS
IEEE_IS_NAN ([X=]x)
ISNAN ([X=]x)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extensions
IEEE Standard for Binary Floating-point Arithmetic
Extension to the IEEE Standard for Binary Floating-point Arithmetic: ISNAN
DESCRIPTION
The IEEE_IS_NAN and ISNAN intrinsic functions return the value TRUE if x is a NaN and return the value
FALSE otherwise. IEEE_IS_NAN and ISNAN are synonyms. These functions accept the following
argument:
x Must be of type real.
These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
IEEE_IS_NAN is accepted by the CF90 and MIPSpro 7 Fortran 90. ISNAN is accepted by the CF90,
MIPSpro 7 Fortran 90, and MIPSpro Fortran 77 compilers.
RETURN VALUES
The result type and type parameter are of type default logical. If x is an array, the result is an array of the
same shape as x.
The value returned has the value TRUE if x is a NaN and the value FALSE otherwise.
EXAMPLES
REA L x
... ! Com pute X.
IF (IEEE_ IS_NAN (x) ) THE N
... ! Do som eth ing .
ELS E
... ! Do someth ing els e.
END IF
NAME
IEEE_NEXT_AFTER – Returns the next representable neighbor of x in the direction toward y
SYNOPSIS
IEEE_NEXT_AFTER ([X=]x, [Y=]y)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_NEXT_AFTER intrinsic function returns the next representable neighbor of x in the direction
toward y.
IEEE_NEXT_AFTER and the Fortran 95 intrinsic function NEAREST(3I) have a number of differences,
including the Fortran 95 restriction that argument s to NEAREST(3I) must not be zero.
IEEE_NEXT_AFTER accepts the following arguments:
x Must be of type real.
y Must be of type real. If x is scalar, y must be scalar. If x is an array, y can be scalar or an array
of the same shape as x.
IEEE_NEXT_AFTER is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type and type parameter is the same type and type parameter as x. If x is an array, the result is an
array of the same shape as x.
The following special cases can affect the result value:
• If x = y, the result is x without any exception being signaled.
• If either x or y is a quiet NaN, the result is one or the other of the input NaNs.
• Overflow is signaled when x is finite but IEEE_NEXT_AFTER(x, y) is infinite. Underflow is signaled
when IEEE_NEXT_AFTER(x, y) lies strictly between -2**E min and +2**E min . In both cases, the
inexact exception is signaled.
The result values are produced from the following combinations of scalar and array arguments:
• If x is scalar, the result is a scalar.
• If x is an array and y is scalar, the result is an array in which each element is the nearest neighbor of x i in
the direction of y.
• If x is an array and y is an array, the result is an array in which each element is the nearest neighbor of x i
in the direction of y i .
EXAMPLES
REA L x, y
... ! Com put e X.
y = IEE E_N EXT _AF TER (x, 1.0 )
SEE ALSO
NEAREST(3I)
NAME
IEEE_REAL – Converts x to a real value
SYNOPSIS
IEEE_REAL ([X=]x [, [Y=]y])
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_REAL intrinsic function converts x to a real value according to the rounding mode currently in
effect. It accepts the following arguments:
x Can be of type real or integer. It can be scalar or an array.
y If specified, must be scalar and of type real.
IEEE_REAL is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type and type parameters are as follows. If y is absent, the result type and type parameter are
default real. If y is present, the result type and type parameter are the same type and type parameter as y. If
x is an array, the result is an array of the same shape as x.
If y is absent, the result is a default real rounded from x according to the rounding mode currently in effect.
When x is of type integer, this form of IEEE_REAL is useful for converting an integer value that has more
significant bits than the number of bits in the mantissa of the default real format or the format of y.
IEEE_REAL, in this case, rounds the integer according to the number of bits in the mantissa. For example,
suppose that on some machine an integer can hold 5 decimal digits, but the floating-point format of the same
size can only hold 4. The result of IEEE_REAL(10126) on this machine would be 1.013E+3 if the
current rounding mode is round-to-nearest. This form of IEEE_REAL is also useful when converting a
double precision y to (default) single precision and, in the process, rounding the fractional value in the
mantissa according to the rounding mode currently in effect.
If y is present, the result is of type real with the same kind type parameter value as y and whose value is
rounded from x according to the rounding mode currently in effect. This form of IEEE_REAL has
essentially the same uses as those described in the previous paragraph, but it allows you to specify a result
type of something other than default real. For example, this form would be useful to convert quad precision
real to double precision (and rounding in the process) on IRIX systems.
If x is scalar, the result is scalar.
If x is an array, the result is an array in which each element is the value of x i rounded to the type and type
parameter of y.
EXAMPLES
! Ass ume that the fol low ing pro gram is com piled and execut ed on
! a 32-bit mac hine.
INT EGE R k
... ! X is fil led with a val ue tha t
... ! has more than 23 sig nifica nt bit s.
PRI NT *, IEE E_R EAL(k)
Variable k is converted to type default real and rounded to fit into 23 bits according to the rounding mode
currently in effect.
NAME
IEEE_REMAINDER – Returns the remainder of x divided by y
SYNOPSIS
IEEE_REMAINDER ([X=]x, [Y=]y)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_REMAINDER intrinsic function returns the remainder of the operation x divided by y. Note that
this function does not have precisely the same definition as either of the Fortran 90 intrinsic functions
MOD(3I) or MODULO(3I).
The IEEE_REMAINDER function accepts the following arguments:
x Must be of type real. It can be scalar or an array.
y Must be of type real. If x is scalar, y can be scalar or an array. If x is an array, y can be scalar
or an array of the same shape as x.
IEEE_REMAINDER is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The same type and kind type parameter as the argument of the largest precision and range. For example, if x
is type REAL(KIND=4) and y is type REAL(KIND=8), the result is of type REAL(KIND=8). If either x
or y is an array, the result is an array of the same shape as one of the array arguments.
The form of the result value is determined as follows:
• If x and y are both scalar, the result is a scalar.
• If x is an array and y is scalar, the result is an array in which each element is the remainder of x i divided
by y.
• If x is scalar and y is an array, the result is an array in which each element is the remainder of x divided
by y i .
• If x is an array and y is an array, the result is an array in which each element is the remainder of x i
divided by y i .
EXAMPLES
REAL x, y, r
... ! Com put e X and Y.
r = IEE E_REMA IND ER( x, y)
IF (r /= 0.0 ) THE N
...
END IF
SEE ALSO
MOD(3I) MODULO(3I)
NAME
IEEE_UNORDERED – Tests for x or y being a NaN
SYNOPSIS
IEEE_UNORDERED ([X=]x, [Y=]y)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_UNORDERED intrinsic function tests for x or y being a NaN. It accepts the following arguments:
x Must be of type real. Can be a scalar or an array.
y Must be of type real. y must be conformable with x.
IEEE_UNORDERED is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type and type parameter are default logical. If either x or y is an array, the result is an array of
the same shape as one of the array arguments.
The return value is .TRUE. if either x or y is a NaN, otherwise the return value is .FALSE.. The
operation does not raise the Invalid Operation interrupt.
If x and y are both scalar, the result is a scalar.
If x is an array and y is scalar, the result is an array in which each element has the value .TRUE. or
.FALSE., depending on whether x i is unordered with y.
If x is scalar and y is an array, the result is an array in which each element has the value .TRUE. or
.FALSE., depending on whether x is unordered with y i .
If x is an array and y is an array, the result is an array in which each element has the value .TRUE. or
.FALSE., depending on whether x i is unordered with y i .
EXAMPLES
REA L x,y
... ! Com put e X.
IF (IE EE_UNO RDE RED (x, y)) THE N
... ! Do som eth ing .
ELS E
... ! Do som eth ing els e.
END IF
NAME
INDEX – Determines the starting location of a character substring in a string
SYNOPSIS
INDEX ([STRING=]string, [SUBSTRING=]substring [,[BACK=]back])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
DESCRIPTION
The INDEX intrinsic function returns the starting position of a substring within a string from either the right
or left end of the string. It accepts the following arguments:
string Must be of type character.
substring Must be of type character.
back Must be of type logical. If omitted, a value of false is assumed. If present with a value of true,
the search begins at the end of string. This argument is not accepted by the MIPSpro Fortran 77
compiler.
INDEX is an elemental function. The name of this intrinsic can be passed as an argument.
NOTES
When the INDEX intrinsic function is passed as an actual argument, it must be called with only the first two
arguments in the routine that calls the passed-in function.
RETURN VALUES
The back argument can affect the return value as follows:
• If back is absent or is present with the value FALSE, the INDEX search is relative to the left end of
string. The result is the minimum positive value of i, as follows:
• If back is present with the value TRUE, the INDEX search is relative to the right end of string. The
result is the maximum positive value of the following:
LEN( string ) + 1.
If substring occurs more than once in string, INDEX returns the index to the first occurrence.
The return value is 0 if the length of string is less than the length of substring.
EXAMPLES
Example 1: INDEX(’FORTRAN’,’R’) yields 3.
Example 2: INDEX(’FORTRAN’,’R’,BACK=.TRUE.) yields 5.
Example 3: The following program returns the index I=10 for the substring SUPERCOMPUTER:
PRO GRAM INDEX1
CHA RAC TER*22 A
CHA RAC TER*13 B
A = ’CR AY T90 SUPERC OMP UTER’
B = ’SU PERCOMPUT ER’
I = IND EX(A,B)
PRINT *, I
STOP
END
NAME
INT, IINT, JINT, KINT, IDINT, IIDINT, JIDINT, KIDINT, IQINT, IIQINT, JIQINT, KIQINT,
IFIX, IIFIX, JIFIX, KIFIX – Converts to type integer
SYNOPSIS
INT ([A=]a [,[KIND=]kind])
IINT ([A=]a)
JINT ([A=]a)
KINT ([A=]a)
IDINT ([A=]a)
IIDINT ([A=]a)
JIDINT ([A=]a)
KIDINT ([A=]a)
IQINT ([A=]a)
IIQINT ([A=]a)
JIQINT ([A=]a)
KIQINT ([A=]a)
IFIX ([A=]a)
IIFIX ([A=]a)
JIFIX ([A=]a)
KIFIX ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: IQINT, IINT, JINT, KINT, IIDINT, JIDINT, KIDINT, IIQINT, JIQINT,
KIQINT, IIFIX, JIFIX, KIFIX
DESCRIPTION
INT is the generic function name. These functions truncate the argument specified and return type integer.
These are elemental intrinsic functions. They accept the following arguments:
a For INT, must be of type integer, real, or complex. For IINT, JINT, and KINT, must be
single precision real. For IDINT, IIDINT, JIDINT, and KIDINT, must be double precision
real. For IQINT, IIQINT, JIQINT, and KIQINT, must be quad precision real.
For IFIX, IIFIX, JIFIX, and KIFIX, must be of type real.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
kind An integer scalar value. The kind type to be used for the result. If not specified, the kind type
for default integer. This argument is not accepted by the MIPSpro Fortran 77 compiler.
These functions convert specified types to type integer by truncating toward 0 (the fraction is lost). Type
conversion routines assign the appropriate type to Boolean arguments without shifting or manipulating the bit
patterns they represent.
NOTES
The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
The return values are of type integer. The magnitude of the return value does not exceed the magnitude of
the argument. The sign of the return value is the same as the sign of a.
INT, IFIX, IDINT, and IQINT, return an integer.
IIFIX, IINT, IIDINT, and IIQINT return an integer (KIND=2).
JIFIX, JINT, JIDINT, and JIQINT return an integer (KIND=4).
KIFIX, KINT, KIDINT, and KIQINT returns an integer (KIND=8).
SEE ALSO
f90(1)
NAME
_int_mult_upper, INT_MULT_UPPER – Multiplies integers and returns the uppermost bits
SYNOPSIS
C/C++:
#include <intrinsics.h>
unsigned long _int_mult_upper (long i, long j)
Fortran:
INT_MULT_UPPER ([I=]i, [J=]j)
IMPLEMENTATION
C/C++: UNICOS/mk systems and UNICOS systems with IEEE floating-point hardware
Fortran: UNICOS/mk systems, IRIX systems, and Cray T90 systems that support IEEE floating-point
arithmetic
Cray C/C++, CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension to the Fortran standard
DESCRIPTION
This intrinsic function takes advantage of a hardware instruction on IRIX systems, UNICOS/mk systems, on
Cray T90 systems that support IEEE floating-point arithmetic. On UNICOS and UNICOS/mk systems, this
hardware instruction multiplies two 64-bit integers, as if they were unsigned, and returns the upper (leftmost)
64 bits of the 128-bit unsigned result. On IRIX systems, this hardware instruction multiplies two 32-bit
integers, as if they were unsigned, and returns the upper (leftmost) 32 bits of the 64-bit unsigned result.
NOTES
C/C++
Because _int_mult_upper is an intrinsic function, no externally visible library function is available for
it. The compiler generates inline code to produce the result.
Fortran
INT_MULT_UPPER accepts the following arguments:
i On UNICOS/mk systems and on Cray T90 systems that support IEEE floating-point arithmetic, i must
be of type INTEGER(KIND=8). On IRIX systems, it can also be of type INTEGER(KIND=4). It
can be a scalar or an array.
j On UNICOS/mk systems and on Cray T90 systems that support IEEE floating-point arithmetic, j must
be of type INTEGER(KIND=8). On IRIX systems, it can also be of type INTEGER(KIND=4). It
can be a scalar or an array. If it is an array, it must be of the same shape as i.
INT_MULT_UPPER is an elemental function. The name of this intrinsic cannot be passed as an argument.
If i and j are scalar, the result is a scalar.
If i is an array and j is scalar, the result is an array of the same shape as i in which each element is the
result of the product of i i and j as described previously.
If i is scalar and j is an array, the result is an array of the same shape as j and in which each element is the
result of the product of i and j i as described previously.
If both i and j are arrays, the result is an array of the same shape as i and in which each element is the result
of the product of i i and j i as described previously.
RETURN VALUES
On UNICOS/mk systems and on Cray T90 systems that support IEEE floating-point arithmetic,
INT_MULT_UPPER returns the upper (leftmost) 64 bits of the 128-bit result of the product of i and j.
On IRIX systems, INT_MULT_UPPER returns a 64-bit integer result if at least one of the arguments is a
64-bit integer; the 32-bit argument is converted to a 64-bit integer. If both i and j are INTEGER(KIND=4)
arguments, the result is the upper (leftmost) 32 bits of the 64-bit result of the product of i and j.
EXAMPLES
Fortran example:
! Assume the follow ing code is exe cuted on a CRAY T90 IEEE.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
INTRO_INTRIN – Introduction to intrinsic procedures
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
DESCRIPTION
Intrinsic procedures are predefined procedures that are defined by the computer programming language.
They are invoked in the same way that other procedures are invoked.
The Fortran standard defines intrinsic procedures, and the CF90 and MIPSpro 7 Fortran 90 compilers support
all the intrinsics described in the Fortran 95 standard. The CF90 and MIPSpro 7 Fortran 90 compilers
support other intrinsics as extensions to the standard. The MIPSpro Fortran 77 compiler conforms to the
outmoded FORTRAN 77 standard; the intrinsics supported by this compiler are fewer in number than those
supported by the CF90 and MIPSpro 7 Fortran 90 compilers.
There are four classes of Fortran intrinsic procedures as defined by the Fortran 95 standard: inquiry
functions, elemental functions, transformational functions, and subroutines. Additional intrinsics provided
with the CF90 and MIPSpro 7 Fortran 90 compiler include intrinsics that support IEEE floating-point
arithmetic and other compiler extensions.
The CF90 and MIPSpro 7 Fortran 90 compilers evaluate intrinsic procedures in line or by calling external
code. Depending on your platform and your program, the following intrinsics can be evaluated in line:
• ABS
• ACHAR
• AIMAG
• AINT
• ALL
• AND
• ANINT
• ANY
• BIT_SIZE
• M@CLR, M@LD, M@MX, M@LDMX, M@UL (the BMM intrinsics)
• BTEST
• CEILING
• CHAR, ICHAR
• CLEAR_IEEE_EXCEPTION
• CLOC
• CMPLX
• COMPL
• CONJG
• COUNT
• CSHIFT
• CSMG
• CVMGM, CVMGN, CVMGP, CVMGZ, CVMGT
• DBLE
• DIGITS
• DIM
• DISABLE_IEEE_INTERRUPT
• DOT_PRODUCT
• DPROD
• DSHIFTL
• DSHIFTR
• ENABLE_IEEE_INTERRUPT
• EOSHIFT
• EPSILON
• EQV
• EXPONENT
• FCD
• FLOOR
• FLOAT
• FRACTION
• GET_IEEE_EXCEPTIONS
• GET_IEEE_INTERRUPTS
• GET_IEEE_ROUNDING_MODE
• GET_IEEE_STATUS
• HUGE
• I24MULT
• IACHAR
• IAND
• IBCLR
• IBITS
• IBSET
• IEEE_CLASS
• IEEE_COPY_SIGN
• IEEE_FINITE
• IEEE_INT
• IEEE_IS_NAN
• IEEE_REAL
• IEEE_UNORDERED
• IEOR
• INT
• INT_MULT_UPPER
• IOR
• ISHFT
• ISHFTC
• KIND
• LBOUND
• LEADZ
• LEN
• LGE, LGT, LLE, LLT
• LOC
• LOGICAL
• MASK
• MATMUL
• MAX
• MAXEXPONENT
• MAXLOC
• MAXVAL
• MEMORY_BARRIER
• MERGE
• MIN
• MINEXPONENT
• MINVAL
• MOD, AMOD
• MODULO
• MVBITS
• MY_PE
• NEAREST
• NEQV, XOR
• NINT
• NOT
• NUMARG
• OR
• POPCNT
• POPPAR
• PRECISION
• PRESENT
• PRODUCT
• RADIX
• RANGE
• REAL
• REMOTE_WRITE_BARRIER
• RRSPACING
• RTC, IRTC
• SCALE
• SELECTED_INT_KIND
• SET_EXPONENT
• SET_IEEE_EXCEPTION
• SET_IEEE_EXCEPTIONS
• SET_IEEE_INTERRUPTS
• SET_IEEE_ROUNDING_MODE
• SET_IEEE_STATUS
• SHAPE
• SHIFT
• SHIFTA
• SHIFTL
• SHIFTR
• SIGN
• SPACING
• SPREAD
• SUM
• SYSTEM_CLOCK
• TEST_IEEE_EXCEPTION
• TEST_IEEE_INTERRUPT
• TINY
• TRANSFER
• TRANSPOSE
• UBOUND
• WRITE_MEMORY_BARRIER
The CF90 compiler supports vector versions of some intrinsic procedures. Using one of these intrinsics
means that the presence of the intrinsic itself, in a loop, does not inhibit the loop’s ability to vectorize.
Vector versions of the following CF90 intrinsic procedures exist on UNICOS platforms:
• ABS
• ACOS, DACOS
• AIMAG
• AINT
• AND
• ANINT
• ASIN
• ATAN
• ATAN2
• BIT_SIZE
• M@CLR, M@LD, M@MX, M@LDMX, and M@UL (the BMM intrinsics)
• BTEST
• CEILING
• CMPLX
• COMPL
• CONJG
• COS
• COSH, DCOSH
• COT, DCOT
• CSMG
• CVMGM, CVMGN, CVMGP, CVMGZ, CVMGT
• DBLE, DFLOAT
• DIGITS
• DIM
• DPROD
• DSHIFTL
• DSHIFTR
• EPSILON
• EQV
• EXP
• EXPONENT
• FLOOR
• FRACTION
• HUGE
• I24MULT
• IAND
• IBCLR
• IBITS
• IBSET
• IEEE_CLASS
• IEEE_COPY_SIGN
• IEEE_FINITE
• IEEE_INT
• IEEE_IS_NAN
• IEEE_REAL
• IEEE_UNORDERED
• IEOR
• INT, IDINT, IFIX
• INT_MULT_UPPER
• IOR
• ISHFT
• ISHFTC
• KIND
• LEADZ
• LOG
• LOG10
• LOGICAL
• MASK
• MAX
• MAXEXPONENT
• MERGE
• MIN
• MINEXPONENT
• MOD
• MVBITS
• NEAREST
• NEQV, XOR
• NINT
• NOT
• OR
• POPCNT
• POPPAR
• PRECISION
• PRESENT
• RADIX
• RANDOM_NUMBER
• RANF
• RANGE
• REAL
• RRSPACING
• SCALE
• SELECTED_INT_KIND
• SET_EXPONENT
• SHIFT
• SHIFTA
• SHIFTL
• SHIFTR
• SIGN
• SIN
• SINH
• SPACING
• SPREAD
• SQRT
• TAN
• TANH
• TINY
The CF90 compiler supports vector versions of some intrinsic procedures and library-based operators on
UNICOS/mk platforms, too. Using one of these intrinsics means that the presence of the intrinsic itself, in a
loop, does not inhibit the loop’s ability to vectorize. On UNICOS/mk platforms, you must specify
-O vector3 and -l mfastv on your f90(1) command line in order for the compiler to be able to use
vector versions of the following intrinsic procedures:
• COS, ACOS
• COSS
• EXP
• LOG, LOG10
• M@LD, M@MX, M@LDMX, and M@UL (the BMM intrinsics)
• POPCNT
• RANF
• RTOR
• SIN, ASIN
• TAN, ATAN, ATAN2
• SQRT
The MIPSpro 7 Fortran 90 and the MIPSpro Fortran 77 compilers support both single-precision and
double-precision vector versions of certain intrinsic procedures when -O3 is specified on the compiler
command line. These intrinsics are as follows:
• COS, ACOS
• EXP
• LOG, LOG10
• SIN, ASIN
• SQRT
• TAN, ATAN
For details about the Fortran 95 intrinsics, see the man pages themselves and the Fortran Language
Reference Manual, Volume 2.
The C/C++ intrinsics either allow direct access to hardware instructions or result in the generation of inline
code to perform specialized functions. The intrinsic functions are processed completely by the compiler, and
no calls to external functions are generated. For details about the C intrinsic procedures, see the Cray
C/C++ Reference Manual.
MATH INTRINSICS
Many mathematical intrinsic procedures have both generic and specific forms. For example, ALOG, DLOG,
QLOG, CLOG, CDLOG, CQLOG, are logarithmic functions. ALOG is generic. The others are specific.
Generic function names cause the compiler to compile automatically the appropriate data type version of a
routine, based on the type of the input data. For example, a call to the generic function LOG with a type of
input data of complex compiles as CLOG.
In general, real functions have no prefix. Integer functions are prefixed with I. Double-precision functions
are prefixed with D. Complex functions are prefixed with C. Double-precision complex functions are
prefixed with CD. For example, ABS, IABS, DABS, QABS, CABS, and CDABS all have prefixes that indicate
a data type. Functions with a type different from their arguments are noted. Real functions are usually the
same as the generic function name.
On UNICOS/mk systems, two precisions are provided for real data: 32-bit, or half-precision real, and 64-bit,
or single-precision real. The specific names for single precision real data provide a link to the 64-bit
intrinsic functions. To ensure a link to the 32-bit intrinsic functions, use the generic function names with
32-bit real arguments. For example, use LOG for any of the types of real data. Use ALOG for single
precision real arguments. Extended precision routines of math library routines are not provided on
UNICOS/mk systems.
UNICOS/mk systems have an additional library named libmfastv. It contains versions of selected math
intrinsics which can be faster than those in the default Math library. These alternate versions are not as
accurate as the default library, and in some cases there are argument restrictions, such as not allowing the
use of infinities. These alternate versions are generally faster for loops with 50 or more iterations. To use
libmfastv, use the -l mfastv option on the compiler’s command line to load the library file. You
must compile your code with the -O3 or -Ovector3 option for the Fortran compiler or use -h vector3
with the C compiler.
The math routines can be divided into the following general categories:
• General arithmetic functions. In the routine descriptions, complex arguments are represented as follows:
x = x r + ix i .
The real part of the complex number is x r .
The imaginary part of the complex number is x i .
Arguments and results are of the same type unless otherwise indicated.
Base values raised to a power and 64-bit integer division are called implicitly from Fortran.
• Exponential and logarithmic functions. Each function has variations for real, double precision, and
complex values except the common logarithm function, which addresses only real and double-precision
values. Complex arguments are represented as follows:
x = x r + ix i
The real part of the complex number is x r .
The imaginary part of the complex number is x i .
• Trigonometric functions. The trigonometric functions are based on the ANSI standard for Fortran, except
for the cotangent functions (COT or COTAN), which are extensions.
• Type conversion functions. Type conversion functions change the type of an argument. In the routine
description, complex arguments are represented as follows:
x = x r + ix i
TERMINOLOGY
The Fortran intrinsic procedure man pages use the terms single precision, double precision, and
quad precision. These terms have different meanings depending on your operating system.
The meaning of the term single precision is as follows:
• On IRIX systems, REAL(KIND=4) and COMPLEX(KIND=4).
• On UNICOS and UNICOS/mk systems, REAL(KIND=8) and COMPLEX(KIND=8).
The meaning of the term double precision is as follows:
• On UNICOS/mk and IRIX systems, REAL(KIND=8) and COMPLEX(KIND=8).
• On UNICOS systems, REAL(KIND=16) and COMPLEX(KIND=16).
The meaning of the term quad precision is as follows:
• On UNICOS and IRIX systems, REAL(KIND=16) and COMPLEX(KIND=16).
• On UNICOS/mk systems, REAL(KIND=8) and COMPLEX(KIND=8).
SEE ALSO
INTRO_LIBM(3M), INTRO_SHMEM(3)
Cray C/C++ Reference Manual
Cray Standard C Reference Manual
CF90 Commands and Directives Reference Manual
Fortran Language Reference Manual, Volume 1
Fortran Language Reference Manual, Volume 2
Fortran Language Reference Manual, Volume 3
NAME
ISHA, IISHA, JISHA, KISHA – Performs arithmetic shift on an integer
SYNOPSIS
ISHA ([I=]i, [SHIFT=]shift)
IISHA ([I=]i, [SHIFT=]shift)
JISHA ([I=]i, [SHIFT=]shift)
KISHA ([I=]i, [SHIFT=]shift)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extensions
DESCRIPTION
The ISHA, IISHA, JISHA, KISHA intrinsic functions perform an arithmetic shift of an integer, left or
right, by a specified number of bits. This function accepts the following arguments:
i Must be of type integer. For IISHA, must be of type integer (KIND=2). For JISHA, must be
of type integer (KIND=4). For KISHA, must be of type integer (KIND=8). This is the value to
be shifted.
shift Must be of type integer. This is the direction and distance of the shift.
Positive shifts are left, toward the most significant bit. Negative shifts are right, toward the least
significant bit. If shift is zero, no shift is performed.
These elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
The result type and type parameter are the same as i. The result is equal to i shifted arithmetically by shift
bits.
Bits shifted out, from the left or from the right, are lost. Zeros are shifted in for a left shift. The sign bit is
extended for a right shift.
The kind of the integer is important because the sign varies among integer representations. If you want to
shift a 1-byte or 2-byte argument, declare it as KIND=1 or KIND=2.
NAME
ISHC, IISHC, JISHC, KISHC – Performs circular shift on an integer
SYNOPSIS
ISHC ([I=]i, [SHIFT=]shift)
IISHC ([I=]i, [SHIFT=]shift)
JISHC ([I=]i, [SHIFT=]shift)
KISHC ([I=]i, [SHIFT=]shift)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extensions
DESCRIPTION
The ISHC, IISHC, JISHC, KISHC intrinsic functions perform a circular shift on an integer. In this shift,
the intrinsic rotates the integer, left or right, by a specified number of bits. Bits shifted out of one end are
shifted in or the other end. No bits are lost. These functions accept the following arguments:
i Must be of type integer. For IISHC, must be of type integer (KIND=2). For JISHC, must be
of type integer (KIND=4). For KISHC, must be of type integer (KIND=8). This is the value to
be shifted.
shift Must be of type integer. This is the direction and distance of rotation.
Positive shifts are left, toward the most significant bit. Negative shifts are right, toward the least
significant bit. If shift is zero, no shift is performed.
These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
The result type and type parameter are the same as i. The result is equal to i rotated by shift bits.
For an integer (KIND=4) argument, 32 bits are shifted. If you want to shift a 1-byte or 2-byte argument,
declare it as KIND=1 or KIND=2, respectively.
NAME
ISHFT, IISHFT, JISHFT, KISHFT, LSHIFT, RSHIFT – Performs a logical shift
SYNOPSIS
ISHFT ([I=]i, [SHIFT=]shift)
IISHFT ([I=]i, [SHIFT=]shift)
JISHFT ([I=]i, [SHIFT=]shift)
KISHFT ([I=]i, [SHIFT=]shift)
LSHIFT ([I=]i, [SHIFT=]shift)
RSHIFT ([I=]i, [SHIFT=]shift)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: IISHFT, JISHFT, KISHFT, LSHIFT, RSHIFT
DESCRIPTION
The ISHFT, IISHFT, JISHFT, KISHFT, LSHIFT and RSHIFT intrinsic functions perform a logical shift.
They accept the following arguments:
i Must be of type integer. For IISHFT, must be of type integer (KIND=2). For JISHFT, must
be of type integer (KIND=4). For KISHFT, must be of type integer (KIND=8).
shift Must be of type integer. The absolute value of shift must be less than or equal to
BIT_SIZE(i).
ISHFT with a positive shift argument can also be specified as LSHIFT. ISHFT with a negative
shift argument can also be specified as RSHIFT with shift .
These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
The result type and type parameters are the same as i. On IRIX systems, the result can be affected by the
-i option on the f90(1) command line.
The result has the value obtained by shifting the bits of i by shift positions. If shift is positive, the shift is to
the left; if shift is negative, the shift is to the right; and if shift is zero, no shift is performed. Bits shifted
out from the left or from the right, as appropriate, are lost. Zeros are shifted in from the opposite end.
LSHIFT and RSHIFT return the value of the first argument shifted left or right, respectively, the number of
times specified by the shift. Zeros are shifted in.
The bit model defines the interpretation of an integer value as a sequence of bits. For more information on
the bit model, see the MODELS(3I) man page.
EXAMPLES
ISHFT(3,1) yields 6.
SEE ALSO
f90(1)
MODELS(3I)
NAME
ISHFTC, IISHFTC, JISHFTC, KISHFTC – Performs a circular shift of the rightmost bits
SYNOPSIS
ISHFTC ([I=]i, [SHIFT=]shift [,[SIZE=]size])
IISHFTC ([I=]i, [SHIFT=]shift [,[SIZE=]size])
JISHFTC ([I=]i, [SHIFT=]shift [,[SIZE=]size])
KISHFTC ([I=]i, [SHIFT=]shift [,[SIZE=]size])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: IISHFTC, JISHFTC, KISHFTC
DESCRIPTION
The ISHFTC, IISHFTC, JISHFTC, and KISHFTC intrinsic functions perform a circular shift of the
rightmost bits. They accept the following arguments:
i Must be of type integer. For IISHFTC, must be of type integer (KIND=2). For JISHFTC,
must be of type integer (KIND=4). For KISHFTC, must be of type integer (KIND=8).
shift Must be of type integer. The absolute value of shift must be less than or equal to size.
size Must be of type integer. The value of size must be positive and must not exceed
BIT_SIZE(i). If size is absent, it is as if it were present with the value of BIT_SIZE(i).
These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
The result type and type parameter are the same as i. The result has the value obtained by shifting the size
rightmost bits of i circularly by shift positions. If shift is positive, the shift is to the left; if shift is negative,
the shift is to the right; and if shift is zero, no shift is performed. No bits are lost. The unshifted bits are
unaltered.
The bit model defines the interpretation of an integer value as a sequence of bits. For more information on
the model, see the MODELS(3I) man page.
EXAMPLES
ISHFTC(3,2,3) yields 5.
SEE ALSO
MODELS(3I)
NAME
ISHL, IISHL, JISHL, KISHL – Performs logical shift with zero fill
SYNOPSIS
ISHL ([I=]i, [SHIFT=]shift)
IISHL ([I=]i, [SHIFT=]shift)
JISHL ([I=]i, [SHIFT=]shift)
KISHL ([I=]i, [SHIFT=]shift)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extensions
DESCRIPTION
The ISHL, IISHL, JISHL, KISHL intrinsic functions perform a logical shift on an integer. In this shift,
the intrinsic shifts the integer, left or right, by a specified number of bits. Bits shifted out of one end are
lost, and zeros are filled in. These functions accept the following arguments:
i Must be of type integer. For IISHL, must be of type integer (KIND=2). For JISHL, must be
of type integer (KIND=4). For KISHL, must be of type integer (KIND=8). This is the value to
be shifted.
shift Must be of type integer. This is the direction and distance of the shift.
Positive shifts are left, toward the most significant bit. Negative shifts are right, toward the least
significant bit. If shift is zero, no shift is performed.
These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
The result type and type parameter are the same as i. The result is equal to i logically shifted by shift bits.
Zeros are shifted in from the opposite end.
The integer kind determines the end that the bits are shifted out of. For an integer (KIND=4) argument, 32
bits are shifted. If you want to shift a 1-byte or 2-byte argument, declare it as KIND=1 or KIND=2.
NAME
KIND – Returns the value of the kind type parameter of x
SYNOPSIS
KIND ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The KIND intrinsic function returns the value of the kind type parameter of x. It maps variable space into
kind values, and it accepts the following argument:
x May be of any intrinsic type
KIND is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a default integer scalar value and has a value equal to the kind type parameter value of x.
EXAMPLES
KIND(0.0) has the kind type parameter value of default real.
NAME
LBOUND – Returns all the lower bounds or a specified lower bound of an array
SYNOPSIS
LBOUND ([ARRAY=]array [,[DIM=]dim])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The LBOUND intrinsic function returns all the lower bounds or a specified lower bound of an array. It
accepts the following arguments:
array May be of any type. It must not be scalar. It must not be a pointer that is disassociated or an
allocatable array that is not allocated.
dim Must be scalar and of type integer with a value in the range 1 ≤ dim ≤ n, where n is the rank of
array. The corresponding actual argument must not be an optional dummy argument.
LBOUND is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is of type default integer. It is scalar if dim is present; otherwise, the result is an array of rank 1
and size n, where n is the rank of array.
For an array section or for an array expression, other than a whole array or array structure component,
LBOUND (array, dim) has the value 1; otherwise, it has a value equal to the lower bound for subscript dim of
array if dimension dim of array does not have size 0 and has the value 1 if dimension dim has size 0.
LBOUND (array) has a value whose ith component is equal to LBOUND (array, i), for i = 1, 2, . . ., n, where
n is the rank of array.
EXAMPLES
Assume that A is declared by the following statement:
REA L A(2 :3, 7:1 0)
NAME
_leadz, LEADZ – Counts number of leading 0 bits
SYNOPSIS
C/C++
#include <intrinsics.h>
int _leadz (long i)
Fortran:
LEADZ ([I=]i)
IMPLEMENTATION
C/C++: UNICOS and UNICOS/mk systems
Fortran: UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
This intrinsic function counts the number of leading 0 bits in i.
NOTES
C/C++
Because _leadz is an intrinsic function, no externally visible library function is available for it. The
compiler generates inline code to produce the result.
Fortran
LEADZ accepts the following argument:
i A Boolean, integer, real, or Cray pointer value. i cannot be declared as REAL(KIND=16).
LEADZ is an elemental function. The name of this function cannot be passed as an argument.
EXAMPLES
The following section of Fortran code shows the LEADZ function used with an argument of type integer.
The bit pattern of the argument and the value of the result are also given. For simplicity, a 16-bit object is
used.
INTEGE R I1, I2
...
I2 = LEA DZ(I1)
--- ------ --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 |
--- ------ --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
I1
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
LEN – Determines the length of a character string
SYNOPSIS
LEN ([STRING=]string)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
DESCRIPTION
The LEN intrinsic function takes Fortran character string arguments and returns an integer length. This
function accepts the following argument:
string Must be of type character. It can be scalar or array valued.
LEN is an inquiry function. The name of this intrinsic can be passed as an argument.
RETURN VALUES
The result type, type parameter, and shape are default integer scalar. The result has a value equal to the
number of characters in string if it is a scalar or in an element of string if it is array valued.
EXAMPLES
The following program returns the length of the character string I=37:
PROGRA M LEN TES T
I=LEN( ’|...+ ... .1. ... +.. ..2 ... .+. ... 3.. ..+ ..’ )
PRINT *,I
STOP
END
NAME
LENGTH – Returns the number of words transferred
SYNOPSIS
LENGTH ([I=]i)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
LENGTH returns the length (in words) of a BUFFER IN or BUFFER OUT statement transfer. It accepts the
following argument:
i Must be a nonnegative integer or Boolean value. Represents a unit number.
If i is an integer, i must be of KIND=8 on UNICOS and UNICOS/mk systems, or of KIND=4
on IRIX systems.
LENGTH is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The value returned is of type default integer.
If the LENGTH function is called during the execution of asynchronous I/O with BUFFER IN or BUFFER
OUT, the execution sequence is delayed until the transfer is complete. LENGTH then returns the number of
words successfully transferred. On UNICOS and UNICOS/mk systems, the length is specified in Cray
words. On IRIX systems, the length is specified in the default word size.
Programs that transfer characters or data from a medium that supports partial-word I/O cannot detect partial-
word transfers. The return value is rounded up to a word count in these cases.
The return value is 0 under the following two conditions:
• An end-of-file or error occurs
• It is following a read or write of a zero-length record.
UNIT(3I) should be used prior to LENGTH to properly distinguish these previous two cases.
EXAMPLES
PROGRA M PGM
DIMENS ION V(1 638 4)
10 BUF FER IN (32 ,-1 ) (V( 1), V(1 638 4))
X= UNIT(3 2)
K= LENGTH (32 )
IF (X .GE . 0.0 ) GOTO 14
11 DO 12 I=1 ,K, 1
12 IF (V(I) .EQ . ’KE Y’) GOT O 13
IF (X .EQ . -1. 0) GOTO 10
STO P
13 ...
...
14 CONTIN UE
END
SEE ALSO
UNIT(3I)
NAME
LEN_TRIM – Returns the length of the character argument without counting trailing blank characters
SYNOPSIS
LEN_TRIM ([STRING=]string)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The LEN_TRIM intrinsic function returns the length of the character argument without counting trailing
blank characters. It accepts the following argument:
string Must be of type character
LEN_TRIM is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type is default integer. The result has a value equal to the number of characters remaining after
any trailing blanks in string are removed. If the argument contains no nonblank characters, the result is 0.
EXAMPLES
LEN_TRIM(’ A B ’) yields 4.
LEN_TRIM(’ ’) yields 0.
NAME
LGE, LGT, LLE, LLT – Compares strings lexically
SYNOPSIS
LGE ([STRING_A=]string_a, [STRING_B=]string_b)
LGT ([STRING_A=]string_a, [STRING_B=]string_b)
LLE ([STRING_A=]string_a, [STRING_B=]string_b)
LLT ([STRING_A=]string_a, [STRING_B=]string_b)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
DESCRIPTION
Each of these type logical functions takes two character string arguments and returns a logical value.
string_a and string_b are compared according to the ASCII collating sequence, and the resulting true or false
value is returned.
string_a and string_b Must be of type default character
The defining equation for each function is as follows:
• For LGE, logic = a 1 is greater than or equal to a 2
• For LGT, logic = a 1 is greater than a 2
• For LLE, logic = a 1 is less than or equal to a 2
• For LLT, logic = a 1 is less than a 2
LGE, LGT, LLE, and LLT are elemental functions. The names of these intrinsics cannot be passed as
arguments.
RETURN VALUES
If the strings are of unequal length, the comparison is made as if the shorter string were extended on the
right with blanks to the length of the longer string. The return value of each intrinsic is as follows:
• LGE. The result is true if the strings are equal or if string_a follows string_b in the ASCII collating
sequence; otherwise, the result is false. Note that the result is true if both string_a and string_b are of
equal length; this includes zero-length strings.
• LGT. The result is true if string_a follows string_b in the ASCII collating sequence; otherwise, it is
false. The result is false if both string_a and string_b are of zero length.
• LLE. The result is true if the strings are equal or if string_a precedes string_b in the ASCII collating
sequence; otherwise, it is false. Note that the result is true if both string_a and string_b are of equal
length; this includes zero-length strings.
• LLT. The result is true if string_a precedes string_b in the ASCII collating sequence; otherwise, it is
false. The result is false if both string_a and string_b are of zero length.
NOTES
When using the CF90 or MIPSpro 7 Fortran 90 compilers, the return value is of type default logical.
NAME
LOC – Obtains the address of a variable
SYNOPSIS
LOC ([I=]i)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extension
DESCRIPTION
LOC returns the address of a variable, constant, or array. It accepts the following arguments:
i The variable for which the address is being requested. Specify a variable of any data type.
LOC can be used to define a Cray pointer. Just like a variable in common storage, a Cray pointee, Cray
pointer, or the argument to LOC is stored in memory before a call to an external procedure and is read out of
memory at its next reference. The variable is also stored before a RETURN or END statement of a
subprogram.
The name of this intrinsic cannot be passed as an argument.
WARNINGS
LOC is often used to compute the difference of two addresses as an offset. The offset is then used to access
one of the arrays by overindexing the other array. UNICOS/mk systems, unlike UNICOS systems, have
several address spaces (called memory segments), and memory references with offsets outside of the segment
are not allowed. If the arrays are in different memory segments, the corresponding offset generates memory
references outside of the segment. These references cause run-time Translation Not Valid errors.
RETURN VALUES
On UNICOS systems, the address returned is a word address. On UNICOS/mk and IRIX systems, the
address returned is a byte address.
On UNICOS and UNICOS/mk systems, the value returned is of type Cray Pointer. On IRIX systems, the
address returned is of type integer. If the -64 compiler option is in effect, the value returned is a KIND=8
value; otherwise, the value returned is a KIND=4 value.
EXAMPLES
Example 1: Consider the following code:
SUB ROUTIN E SUB (N)
COMMON POO L(1000 00)
INT EGER BLK(12 8), WOR D64
REA L A(1 000), B(N ), C(1 000 00- N-1 000 )
POI NTER(P BLK,BL K), (IA ,A) ,(I B,B ),( IC, C), (AD DRE SS, WOR D64 )
DAT A ADD RESS /64 /
PBL K = 0
IA = LOC (POOL)
IB = IA + 1000
IC = IB + N
In effect, WORD64 in this example refers to the contents of absolute address 64; BLK is an array occupying
the first 128 words of memory; A is an array of length 1000 located in blank common; B follows A and is of
length N; C follows B. A, B, and C are associated with POOL. Similarly, WORD64 is the same as BLK(65),
because BLK(1) is at address 0.
Example 2: Consider the following code:
POI NTER (P,B), (P, C)
REA L X,B ,C
P = LOC (X)
B = 1.0
C = 2.0
PRI NT *,B
Because B and C have the same Cray pointer, the assignment of 2.0 to C gives the same value to B;
therefore, B prints as 2.0 even though it was assigned 1.0.
NAME
LOG10, ALOG10, DLOG10, QLOG10 – Computes common logarithm
SYNOPSIS
LOG10 ([X=]x)
ALOG10 ([X=]x)
DLOG10 ([X=]x)
QLOG10 ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QLOG10
DESCRIPTION
LOG10 is the generic function name; the others are specifics. These are elemental intrinsic functions. These
functions accept the following argument:
x Must be type single precision, double precision, or quad precision. See the RETURN VALUES
section for information on input data types and return values.
These functions evaluate y = log 10 (x).
Vector versions of these intrinsics exist on some systems. Vector versions of ALOG10 and DLOG10
intrinsics exist on UNICOS and UNICOS/mk systems. On UNICOS/mk systems, the vector version of these
intrinsics is used when -O vector3 or -O3 are specified on the compiler command line. On UNICOS/mk
systems, the 64-bit intrinsic vectorizes; the 32-bit version does not. A vector version of the single-precision
and double-precision LOG10 intrinsic exists on IRIX systems and is used when -O3 is specified on the
compiler command line.
NOTES
The ALOG10 and DLOG10 intrinsic function names can be passed as arguments; the others cannot.
On Cray T90 systems that support IEEE arithmetic, the following return values occur:
• ALOG10(0) yields -infinity.
• ALOG10(-0) yields NaN.
• If -infinity ≤ x < 0, ALOG10(x) yields NaN.
• ALOG10(infinity) yields infinity.
RETURN VALUES
LOG10 returns the real logarithm of its argument. The generic function LOG10 becomes a call to ALOG10,
DLOG10, or QLOG10 depending on the data type and kind of its argument.
ALOG10 returns the real common logarithm of its real argument.
DLOG10 returns the double-precision common logarithm of its double-precision argument.
QLOG10 returns the quad-precision common logarithm of its quad-precision argument.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
NAME
LOG2_IMAGES – Returns the base 2 logarithm of the number of executing images truncated to an integer
SYNOPSIS
LOG2_IMAGES()
IMPLEMENTATION
UNICOS/mk systems
CF90
STANDARDS
Fortran extension
DESCRIPTION
LOG2_IMAGES is an intrinsic procedure that returns the base 2 logarithm of the number of executing
images, truncated to an integer. It is an inquiry function.
RETURN VALUES
The LOG2_IMAGES intrinsic function returns a scalar value of type default integer.
SEE ALSO
CF90 Co-array Programming Manual
NAME
LOG, ALOG, DLOG, QLOG, CLOG, CDLOG, CQLOG – Computes natural logarithm
SYNOPSIS
LOG ([X=]x)
ALOG ([X=]x)
DLOG ([X=]x)
QLOG ([X=]x)
CLOG ([X=]x)
CDLOG ([X=]x)
CQLOG ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QLOG, CDLOG, CQLOG
DESCRIPTION
LOG is the generic function name; the others are specifics. These are elemental intrinsic functions. They
accept the following argument:
x For ALOG, DLOG, and QLOG, x must be greater than zero and of type real. For CLOG, CDLOG,
and CQLOG, x must be of type complex and not equal to (0.,0.). The type and kind type of
x is identical to the type and kind type of the return value. See the RETURN VALUES section
for information on input data types and return values.
Vector versions of these intrinsics exist on some systems. Vector versions of ALOG, DLOG, CLOG, and
CDLOG exist on UNICOS and UNICOS/mk systems. On UNICOS/mk systems, the vector versions of these
intrinsics are used when -O vector3 or -O3 are specified on the compiler command line. A vector
version of the single-precision and double-precision LOG intrinsic exists on IRIX systems and is used when
-O3 is specified on the compiler command line.
These functions evaluate y = ln(x).
CDLOG is called implicitly by as a result of a generic ALOG call with a complex double-precision argument.
NOTES
The ALOG, DLOG, and CLOG intrinsic function names can be passed as arguments; the others cannot.
On Cray T90 systems that support IEEE arithmetic, the following return values occur:
• ALOG(0) yields -infinity.
• ALOG(-0) yields NaN.
• If -infinity ≤ x < 0, ALOG(x) yields NaN.
• ALOG(infinity) yields infinity.
RETURN VALUES
The generic function LOG becomes a call to one of the other functions depending on the type of its
argument.
ALOG returns the real natural logarithm of its real argument.
DLOG returns the double-precision natural logarithm of its double-precision argument.
QLOG returns the quad-precision natural logarithm of its quad-precision argument.
CLOG returns the complex natural logarithm of its complex argument. Its argument cannot equal (0.,0.).
The range of the imaginary part is -pi < imaginary_part ≤ pi.
CDLOG returns the complex double-precision natural logarithm of its complex double-precision argument.
CQLOG returns the complex quad-precision natural logarithm of its complex quad-precision argument.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
NAME
LOGICAL – Converts between kinds of logical
SYNOPSIS
LOGICAL ([L=]l [,[KIND=]kind])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The LOGICAL intrinsic function converts between kinds of logical. It accepts the following arguments:
l Must be of type logical
kind An integer scalar value. Must be a scalar integer initialization expression
LOGICAL is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type is logical. If kind is present, the kind type parameter is that specified by kind; otherwise, the
kind type parameter is that of default logical. The value is that of l.
EXAMPLES
LOGICAL(L.OR..NOT.L) yields TRUE and is of type default logical, regardless of the kind type
parameter of the logical variable L.
NAME
LONG – Returns integer (KIND=4) result
SYNOPSIS
LONG ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
LONG returns an integer (KIND=4) result for a given argument. This intrinsic accepts the following
argument:
a Must be of type integer, real, or complex.
This is an elemental function. The name of this intrinsic cannot be passed an an argument.
RETURN VALUES
The return value is an integer (KIND=4).
SEE ALSO
SHORT(3I)
NAME
MALLOC, FREE – Allocates and deallocates main memory
SYNOPSIS
MALLOC ([N=]nbytes)
CALL FREE ([P=]iptr)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extension
DESCRIPTION
MALLOC and FREE provide a simple general-purpose memory allocation package. MALLOC returns a
pointer to a block of at least nbytes bytes suitably aligned for any use. MALLOC returns the first contiguous
region of free space found in a circular search from the last block allocated or freed, coalescing adjacent free
blocks as it searches. It calls sbrk(2) to get more memory from the system when there is no suitable space
already free.
FREE is a pointer to a block previously allocated by MALLOC. After FREE is performed, this space is made
available for further allocation, but its contents are left undisturbed.
As intrinsics, these are elemental functions. They accept the following arguments:
nbytes The amount to be allocated.
iptr A pointer to the block of memory to be freed.
RETURN VALUES
Undefined results occur if the space assigned by MALLOC is overrun or if some random number is handed to
FREE.
MALLOC returns a NULL pointer if there is no available memory or if the area has been detectably corrupted
by storing outside the bounds of a block. When this happens the block pointed to by iptr can be destroyed.
NOTES
For most MIPSpro 7 Fortran 90 and CF90 applications, MALLOC and FREE can be replaced by the
ALLOOCATE and DEALLOCATE Fortran statements. The statements are simpler and portable.
Search time increases when many objects have been allocated; that is, if a program allocates but never frees,
then each successive allocation takes longer.
IRIX systems can be configured with virtual swap space. This allows processes to allocate more virtual
memory than is actually available, allowing the use of sparse addressing, successful forks and subsequent
exec(2)s by programs larger than 1/2 the available virtual memory, and so forth. Thus programs using
MALLOC can get a successful return. Later, however the system may generate a SIGKILL signal if virtual
memory was overcommitted and processes attempt to actually use all of the overcommitted memory. If the
system has no virtual swap space configured, then processes are limited to using no more virtual memory
than the sum of physical memory and swap space. See the swap(1M) man page for more information.
SEE ALSO
swap(1M)
exec(2), sbrk(2)
NAME
_mask, _maskl, _maskr, MASK – Returns a bit mask
SYNOPSIS
C/C++:
#include <intrinsics.h>
long _mask (long i);
long _maskl (long i);
long _maskr (long i);
Fortran:
MASK ([I=]i)
IMPLEMENTATION
C/C++: UNICOS and UNICOS/mk systems
Fortran: UNICOS, UNICOS/mk, and IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
C++
The _mask function forms a mask of bits set to 1, left-justified or right-justified. If 0 ≤ i ≤ 63, a
left-justified mask of bits set to 1, i bits long, is formed. Otherwise, a right-justified mask of bits set to 1,
(128 – i) bits long, is formed. Value i must be in the range of 0 through 128.
The _maskl function returns a left-justified mask of i bits set to 1. Value i must be in the range of 0
through 64.
The _maskr function returns a right-justified mask of i bits set to 1. Value i must be in the range of 0
through 64.
Because these are intrinsic functions, no externally visible library functions are available for them. The
compiler generates inline code to produce the result.
Fortran
The MASK function returns a bit mask of 1’s.
On UNICOS systems, the argument is a 64-bit integer.
On UNICOS/mk systems, the argument is a 32-bit or 64-bit integer.
On IRIX systems, the argument is an 8-bit, 16-bit, 32-bit, or 64-bit integer.
It accepts the following argument:
i In Fortran, this must be an integer argument, as follows:
• If i is an 8-bit object, i must be in the range 0 ≤ i ≤ 16.
• If i is a 16-bit object, i must be in the range 0 ≤ i ≤ 32.
• If i is a 32-bit object, i must be in the range 0 ≤ i ≤ 64.
• If i is a 64-bit object, i must be in the range 0 ≤ i ≤ 128.
MASK is an elemental function. The name of this function cannot be passed as an argument.
This is an outmoded routine. Refer to the Fortran Language Reference Manual, Volume 2, for information
about outmoded features and their preferred standard alternatives.
RETURN VALUES
In C/C++, the mask functions return a 64-bit object.
In Fortran, MASK returns a Boolean result on UNICOS and UNICOS/mk systems. It returns an integer result
on IRIX systems.
When i is a 64-bit object, the return values are of the following form:
• If i is in the range 0 ≤ i ≤ 64, a left-justified mask of i bits is returned.
• If i is in the range 65 ≤ i ≤ 128, a right-justified mask of (128 - i) bits is returned.
When i is a 32-bit object, the return values are of the following form:
• If i is in the range 0 ≤ i ≤ 32, a left-justified mask of i bits is returned.
• If i is in the range 33 ≤ i ≤ 64, a right-justified mask of (64 - i) bits is returned.
When i is a 16-bit object, the return values are of the following form:
• If i is in the range 0 ≤ i ≤ 16, a left-justified mask of i bits is returned.
• If i is in the range 17 ≤ i ≤ 32, a right-justified mask of (32 - i) bits is returned.
When i is a 8-bit object, the return values are of the following form:
• If i is in the range 0 ≤ i ≤ 8, a left-justified mask of i bits is returned.
• If i is in the range 7 ≤ i ≤ 16, a right-justified mask of (16 - i) bits is returned.
EXAMPLES
Fortran: The following section of Fortran code shows the MASK function used with several different
arguments. The bit patterns of the results are given.
INTEGE R I1, I2, I3
...
I1 = MAS K(3)
I2 = MAS K(64)
I3 = MAS K(127)
--- ------ ------ --- --- --- --- --- --- --- --- --- --- --- --- --
| 1 | 1 | 1 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 0 |
--- ------ ------ --- --- --- --- --- --- --- --- --- --- --- --- --
I1
--- ------ ------ --- --- --- --- --- --- --- --- --- ---
| 1 | 1 | 1 | 1 | ... | 1 | 1 | 1 | 1 |
--- ------ ------ --- --- --- --- --- --- --- --- --- ---
I2
--- ------ ------ --- --- --- --- --- --- --- --- --- ---
| 0 | 0 | 0 | 0 | ... | 0 | 0 | 0 | 1 |
--- ------ ------ --- --- --- --- --- --- --- --- --- ---
I3
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
MATMUL – Performs matrix multiplication of numeric or logical matrices
SYNOPSIS
MATMUL ([MATRIX_A=]matrix_a, [MATRIX_B=]matrix_b)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MATMUL intrinsic function performs matrix multiplication operations on numeric or logical matrices. It
accepts the following arguments:
matrix_a Must be of numeric type (integer, real, or complex) or of logical type. It must be array valued
and of rank one or two.
matrix_b Must be of numeric type if matrix_a is of numeric type and of logical type if matrix_a is of
logical type. It must be array valued and of rank one or two. If matrix_a has rank one,
matrix_b must have rank two. If matrix_b has rank one, matrix_a must have rank two. The
size of the first (or only) dimension of matrix_b must equal the size of the last (or only)
dimension of matrix_a.
MATMUL is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type, type parameter, and shape are as follows. If the arguments are of numeric type, the type and
kind type parameter of the result are determined by the types of the arguments. If the arguments are of type
logical, the result is of type logical with the kind type parameter of the arguments. The shape of the result
depends on the shapes of the arguments, as follows:
• If matrix_a has shape (n, m) and matrix_b has shape (m, k), the result has shape (n, k).
• If matrix_a has shape (m) and matrix_b has shape (m, k), the result has shape (k).
• If matrix_a has shape (n, m) and matrix_b has shape (m), the result has shape (n).
Element (i, j) of the result has the value SUM(MATRIX_A(i,:)*MATRIX_B(:,j)) if the arguments are of
numeric type and has the value ANY(MATRIX_A(i,:).AND.MATRIX_B(:,j)) if the arguments are of
logical type.
Element (j) of the result has the value SUM(MATRIX_A(:)*MATRIX_B(:,j)) if the arguments are of
numeric type and has the value ANY(MATRIX_A(:).AND.MATRIX_B(:,j)) if the arguments are of
logical type.
Element (i) of the result has the value SUM(MATRIX_A(i,:)*MATRIX_B(:)) if the arguments are of
numeric type and has the value ANY(MATRIX_A(i,:).AND.MATRIX_B(:)) if the arguments are of
logical type.
EXAMPLES
Let A and B be the following matrices:
123
234
and
12
23
24
Let X and Y be vectors [1,2] and [1,2,3].
MATMUL(A,B) yields the matrix-matrix product AB, as follows:
11 20
16 29
MATMUL(X,A) yields the vector-matrix product XA with the value [5,8,11].
MATMUL(A,Y) yields the matrix-vector product AY with the value [14,20].
NAME
MAX, MAX0, AMAX1, DMAX1, QMAX1, MAX1, AMAX0 – Returns maximum values
SYNOPSIS
MAX0 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
AMAX1 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
DMAX1 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
QMAX1 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
MAX1 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
AMAX0 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QMAX1
DESCRIPTION
The MAX, MAX0, AMAX1, DMAX1, QMAX1, MAX1, and AMAX0 intrinsic functions determine maximum
values. MAX is the generic name; the others are specifics. They accept the following arguments:
a1, a2, a3, . . .
The arguments must be all of type real or all of type integer. All arguments must have the same data
type.
The kind types of the arguments can differ. This is an extension to the Fortran standard.
These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
NOTES
On UNICOS systems, both execution speed and the number of bits used in mathematical operations are
affected when compiling with f90 -O fastint, which is the default setting. For more information, see
CF90 Commands and Directives Reference Manual.
RETURN VALUES
The value of the result is that of the largest argument.
MAX accepts type real or integer and returns a result with the same type and kind type as its arguments.
MAX0 accepts and returns type integer.
AMAX1 accepts and returns type single-precision real.
DMAX1 accepts and returns type double-precision real.
QMAX1 accepts and returns type quad-precision real.
MAX1 accepts type real and returns type default integer.
AMAX0 accepts type integer and returns type default real.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
EXAMPLES
MAX(-9.0,7.0,2.0) yields 7.0.
NAME
MAXEXPONENT – Returns the maximum exponent in the numeric model
SYNOPSIS
MAXEXPONENT ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MAXEXPONENT intrinsic function returns the maximum exponent in the real number model. For more
information on the real number model, see the MODELS(3I) man page. It accepts the following argument:
x Must be of type real. It may be scalar or array valued.
MAXEXPONENT is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a default integer scalar. The result has the value e max , as defined in the model, which
represents numbers of the same type and kind type parameter as x.
EXAMPLES
On UNICOS systems, excluding Cray T90 systems that support IEEE floating-point arithmetic,
MAXEXPONENT(X) has the value 8189 for real X.
On IRIX systems, MAXEXPONENT(X) yields the following values:
• 128 for real X
• 128 for real (KIND=4) X
• 1024 for real (KIND=8) X
On UNICOS/mk systems, MAXEXPONENT(X) yields the following values:
• 1024 for real X
• 128 for real (KIND=4) X
• 1024 for real (KIND=8) X
On Cray T90 systems that support IEEE floating-point arithmetic, MAXEXPONENT(X) yields the following
values:
• 1024 for real X
• 128 for real (KIND=4) X
• 1024 for real (KIND=8) X
• 16384 for real (KIND=16) X
SEE ALSO
MODELS(3I)
NAME
MAXLOC – Returns the location of a maximum value in an array
SYNOPSIS
MAXLOC ([ARRAY=]array [,[DIM=]dim] [,[MASK=]mask])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MAXLOC intrinsic function returns the location of the first element of array having the maximum value
of the elements identified by mask. It accepts the following arguments:
array Must be of type integer or real. It must not be scalar.
dim Must be a scalar integer value in the range 1 ≤ dim ≤ n, where n is the rank of array. The
corresponding actual argument must not be an optional dummy argument.
mask Must be of type logical and must be conformable with array.
MAXLOC is a transformational function. The name of this intrinsic cannot be passed as an argument.
NOTES
On UNICOS systems, both execution speed and the number of bits used in mathematical operations are
affected when compiling with f90 -O fastint, which is the default setting. For more information, see
CF90 Commands and Directives Reference Manual.
RETURN VALUES
The result is an integer of type default integer, of rank one, with size equal to the rank of array.
The result of MAXLOC(array) is a rank one array whose element values are the values of the subscripts of
an element of array whose value equals the maximum value of all of the elements of array. The ith
subscript returned lies in the range 1 to e i , where e i is the extent of the ith dimension of array. If more than
one element has the maximum value, the element whose subscripts are returned is the first such element,
taken in array element order. If array has size 0, the value of the result is undefined.
The result of MAXLOC(array,MASK=mask) is a rank one array whose element values are the values of the
subscripts of an element of array, corresponding to a true element of mask whose value equals the maximum
value of all such elements of array. The ith subscript returned lies in the range 1 to e i , where e i is the
extent of the ith dimension of array. If more than one such element has the maximum value, the element
whose subscripts are returned is the first such element taken in array element order. If there are no such
elements (that is, if array has size 0 or if every element of mask has the value false), the value of the result
is undefined.
If array has rank one, the result of MAXLOC(array, DIM=dim [, MASK=mask]) is a scalar with a value
that is the same as that of the first element of MAXLOC(array [, MASK=mask]). Otherwise, the value of
element (s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ) of the result is equal to
MAXLOC(array(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n ), DIM=1
[, MASK=mask(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )]).
An element of the result is undefined if the value cannot be represented as an integer.
EXAMPLES
Example 1: MAXLOC((/2,6,4,6/)) yields [2].
Example 2: Assume that array B is declared as follows:
INT EGER, DIMENS ION (4:7) :: B = (/ 8,6 ,3, 1/)
NAME
MAXVAL – Returns the maximum value in an array
SYNOPSIS
MAXVAL ([ARRAY=]array [,[DIM=]dim] [,[MASK=]mask])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MAXVAL intrinsic function can be used for array reduction. It returns the maximum value of the
elements of array along dimension dim corresponding to the true elements of mask. It accepts the following
arguments:
array Must be of type integer or real. It must not be scalar.
dim Must be a scalar integer value in the range 1 ≤ dim ≤ n, where n is the rank of array. The
corresponding actual argument must not be an optional dummy argument.
mask This optional argument must be of type logical and must be conformable with array.
MAXVAL is a transformational intrinsic function. The name of this intrinsic cannot be passed as an
argument.
NOTES
On UNICOS systems, both execution speed and the number of bits used in mathematical operations are
affected when compiling with f90 -O fastint, which is the default setting. For more information, see
CF90 Commands and Directives Reference Manual.
RETURN VALUES
The result is of the same type as array. It is scalar if dim is absent or array has rank one. Otherwise, the
result is an array of rank n– 1 and of shape (d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ), where (d 1 , d 2 , . . ., d n ) is the
shape of array.
The result of MAXVAL(array) has a value equal to the maximum value of all the elements of array or has
the value of the negative number of the largest magnitude supported for numbers of the data type of array if
array is a zero-sized array.
The result of MAXVAL(array,MASK=mask) has a value equal to the maximum value of all the elements of
array corresponding to true elements of mask or has the value of the negative number of the largest
magnitude supported for numbers of the data type of array if there are no true elements.
If array has rank one, MAXVAL(array,dim[,mask]) has a value equal to that of
MAXVAL(array[,MASK=mask]). Otherwise, the value of element (s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ) of
MAXVAL(array,dim[,mask]) is equal to MAXVAL(array(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )
[, MASK=mask(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )]).
On UNICOS and UNICOS/mk systems, MAXVAL returns the value of -HUGE(array) for all zero-sized
arrays. On IRIX systems, MAXVAL returns the value of -INFINITY for real, zero-sized arrays. A request
for interpretation of the Fortran 95 standard may change one of these return values for a real array in a
future release.
EXAMPLES
Example 1: MAXVAL((/1,2,3/)) yields 3.
Example 2: Assume that C is array [10,-100,10]. Then MAXVAL(C,MASK=C.LT.0.0) finds the
maximum of the negative elements of C (which is -100) and MAXVAL(C,MASK=C.GT.10) returns a
negative number of the largest possible integer because there are no true elements using the mask.
Example 3: Assume that B is the following array:
135
246
The following are true:
• MAXVAL(B,DIM=1) yields [2,4,6].
• MAXVAL(B,DIM=2) yields [5,6].
• MAXVAL(B) yields 6.
Example 4: Assume that N is the following array:
0123
4567
8901
The following are true:
• MAXVAL(N(2:3,2:4),MASK=N(2:3,2:4).NE.0) yields 9.
• MAXVAL(N(2:3,2:4),DIM=1,N(2:3,2:4).NE.0) yields [9,6,7].
• MAXVAL(N(2:3,2:4),DIM=2,N(2:3,2:4).NE.0) yields [7,9].
NAME
_memory_barrier, MEMORY_BARRIER – Blocks subsequent memory load and store operations until all
previous loads and stores finish
SYNOPSIS
C/C++:
void _memory_barrier (void);
Fortran:
MEMORY_BARRIER ()
IMPLEMENTATION
UNICOS/mk systems
Cray C/C++, CF90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
This intrinsic guarantees that subsequent loads and stores do not access memory until after previous loads
and stores finish accessing memory.
NOTES
C/C++
Because _memory_barrier is an intrinsic function, no externally visible library function is available for
it. The compiler generates inline code to produce the result.
Fortran
The name of this intrinsic cannot be passed as an argument.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
MERGE – Chooses an alternative value according to the value of a mask
SYNOPSIS
MERGE ([TSOURCE=]tsource, [FSOURCE=]fsource, [MASK=]mask)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MERGE intrinsic function can be used for array construction. It chooses an alternative value according
to the value of mask. This function accepts the following arguments:
tsource May be of any type
fsource Must be of the same type and type parameters as tsource
mask Must be of type logical
MERGE is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result has the same type and type parameters as tsource. The result is tsource if mask is true and
fsource otherwise.
EXAMPLES
Example 1: Assume that TSOURCE, FSOURCE, and MASK are arrays. Array TSOURCE is as follows:
165
246
Array FSOURCE is as follows:
032
748
Array MASK is as follows:
TFT
FFT
Also assume that the letter T represents the value TRUE and the letter F represents the value FALSE. The
statement MERGE(TSOURCE,FSOURCE,MASK) generates the following:
135
746
Example 2: MERGE(1.0,0,0,K>0) yields [1.0] for K = 5.
Example 3: MERGE(1.0,0,0,K>0) yields [0.0] for K = -2.
NAME
MIN, MIN0, AMIN1, DMIN1, QMIN1, MIN1, AMIN0 – Returns minimum values
SYNOPSIS
MIN0 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
AMIN1 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
DMIN1 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
QMIN1 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
MIN1 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
AMIN0 ([A1=]a1, [A2=]a2 [,[A3=]a3] . . . )
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QMIN1
DESCRIPTION
The MIN, MIN0, AMIN1, DMIN1, QMIN1, MIN1, and AMIN0 intrinsic functions find minimum values.
MIN is the generic name; the others are specifics. They accept the following arguments:
a1, a2, a3, . . .
The arguments must be all of type real or all of type integer. All arguments must have the same
data type.
The kind types of the arguments can differ. This is an extension to the Fortran standard.
These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
NOTES
On UNICOS systems, both execution speed and the number of bits used in mathematical operations are
affected when compiling with f90 -O fastint, which is the default setting. For more information, see
CF90 Commands and Directives Reference Manual.
RETURN VALUES
The value of the result is that of the smallest argument.
MIN accepts type real or integer and returns a result with the same type and kind type as its arguments.
MIN0 accepts and returns type integer.
AMIN1 accepts and returns type single-precision real.
DMIN1 accepts and returns type double-precision real.
QMIN1 accepts and returns type quad-precision real.
MIN1 accepts type real and returns type default integer.
AMIN0 accepts type integer and returns type default real.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
EXAMPLES
MIN(-9.0,7.0,2.0) yields -9.0.
NAME
MINEXPONENT – Returns the minimum (most negative) exponent of a real number in the numeric model
SYNOPSIS
MINEXPONENT ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MINEXPONENT intrinsic function returns the minimum (most negative) exponent of a real number in
the numeric model representing numbers of the same type and kind type parameter as the argument. The
real number model is defined in the MODELS(3I) man page. It accepts the following argument:
x Must be of type real. It can be scalar or array valued.
MINEXPONENT is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a default integer scalar. The result has the value e min as defined in the model, which represents
numbers of the same type and kind type parameter as x.
EXAMPLES
On UNICOS systems, except for Cray T90 systems that support IEEE floating-point arithmetic,
MINEXPONENT(X) has the value – 8188 for real X.
On IRIX systems, MINEXPONENT(X) has the following values:
• – 125 for real (KIND=4) X
• – 1021 for real (KIND=8) X
• – 967 for real (KIND=16) X
On Cray T90 systems that support IEEE floating-point arithmetic, MINEXPONENT(X) has the following
values:
• – 125 for real (KIND=4) X
• – 1021 for real (KIND=8) X
• – 16381 for real (KIND=16) X
NAME
MINLOC – Returns the location of a minimum value in an array
SYNOPSIS
MINLOC ([ARRAY=]array [,[DIM=]dim] [,[MASK=]mask])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MINLOC intrinsic function can be used for array location. It returns the location of the first element of
array that has the minimum value of the elements identified by mask. It accepts the following arguments:
array Must be of type integer or real. It must not be scalar.
dim Must be a scalar integer value in the range 1 ≤ dim ≤ n, where n is the rank of array. The
corresponding actual argument must not be an optional dummy argument.
mask Must be of type logical and must be conformable with array.
MINLOC is a transformational function. The name of this intrinsic cannot be passed as an argument.
NOTES
On UNICOS systems, both execution speed and the number of bits used in mathematical operations are
affected when compiling with f90 -O fastint, which is the default setting. For more information, see
CF90 Commands and Directives Reference Manual.
RETURN VALUES
The result is an integer array of type default integer, of rank one, with size equal to the rank of array.
The result of MINLOC(array) is a rank-one array whose element values are the values of the subscripts of
an element of array whose value equals the minimum value of all of the elements of array. The ith
subscript returned lies in the range 1 to e i , where e i is the extent of the ith dimension of array. If more than
one element has the minimum value, the element whose subscripts are returned is the first such element,
taken in array element order. If array has size zero, the value of the result is undefined.
The result of MINLOC(array,MASK=mask) is a rank-one array whose element values are the values of the
subscripts of an element of array, corresponding to a true element of mask whose value equals the minimum
value of all such elements of array. The ith subscript returned lies in the range 1 to e i , where e i is the
extent of the ith dimension of array. If more than one such element has the minimum value, the element
whose subscripts are returned is the first such element taken in array element order. If there are no such
elements (that is, if array has size zero or every element of mask has the value false), the value of the result
is undefined.
If array has rank one, the result of MINLOC(array, DIM=dim [, MASK=mask]) is a scalar with a value
that is the same as that of the first element of MINLOC(array [, MASK=mask]). Otherwise, the value of
element (s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ) of the result is equal to
MINLOC(array(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n ), DIM=1
[, MASK=mask(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )]).
An element of the result is undefined if the value cannot be represented as an integer.
EXAMPLES
Example 1: MINLOC((/4,3,6,3/)) yields [2].
Example 2: Assume that array B is declared as follows:
INT EGER, DIMENS ION (4:7) :: B = (/8 ,6, 3,1 /)
NAME
MINVAL – Returns the minimum value in an array
SYNOPSIS
MINVAL ([ARRAY=]array [,[DIM=]dim] [,[MASK=]mask])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MINVAL intrinsic function can be used for array reduction. It returns the minimum value of the
elements of array along dimension dim corresponding to the true elements of mask. It accepts the following
arguments:
array Must be of type integer or real. It must not be scalar.
dim Must be a scalar integer value in the range 1 ≤ dim ≤ n, where n is the rank of array. The
corresponding actual argument must not be an optional dummy argument.
mask Must be of type logical and must be conformable with array.
MINVAL is a transformational intrinsic function. The name of this intrinsic cannot be passed as an
argument.
NOTES
On UNICOS systems, both execution speed and the number of bits used in mathematical operations are
affected when compiling with f90 -O fastint, which is the default setting. For more information, see
CF90 Commands and Directives Reference Manual.
RETURN VALUES
The result is of the same type as array. It is scalar if dim is absent or array has rank one. Otherwise, the
result is an array of rank n– 1 and of shape (d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ), where (d 1 , d 2 , . . ., d n ) is the
shape of array.
The result of MINVAL(array) has a value equal to the minimum value of all the elements of array or has
the value of the positive number of the largest magnitude supported for numbers of the data type of array if
array is a zero-sized array.
The result of MINVAL(array,MASK=mask) has a value equal to the minimum value of all the elements of
array corresponding to true elements of mask or has the value of the positive number of the largest
magnitude supported for numbers of the data type of array if there are no true elements.
If array has rank one, MINVAL(array,dim[,mask]) has a value equal to that of
MINVAL(array[,MASK=mask]). Otherwise, the value of element (s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ) of
MINVAL(array,dim[,mask]) is equal to MINVAL(array(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n ),
[, MASK=mask(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )]).
On UNICOS and UNICOS/mk systems, MINVAL returns the value of +HUGE(array) for all zero-sized
arrays. On IRIX systems, MINVAL returns the value of +INFINITY for real, zero-sized arrays. A request
for interpretation of the Fortran 95 standard may change one of these return values for a real array in a
future release.
EXAMPLES
Example 1: MINVAL((/1,2,3/)) yields 1.
Example 2: Assume that C is array [10,-100,10]. MINVAL(C,MASK=C.LT.0) yields the minimum
of the negative elements of C, which is -100. MINVAL(C,MASK=C.GT.10) returns the largest possible
integer because there are no true elements using the mask.
Example 3: Assume that B is the following array:
135
246
The following are true:
• MINVAL(B,DIM=1) yields [1,3,5].
• MINVAL(B,DIM=2) yields [1,2].
• MINVAL(B) yields 1.
Example 4: Assume that N is the following array:
0123
4567
8901
In an array section reference, the following are true:
• MINVAL(N(2:3,2:4),MASK=N(2:3,2:4).NE.0) yields 1.
• MINVAL(N(2:3,2:4),DIM=1,N(2:3,2:4).NE.0) yields [5,6,1].
• MINVAL(N(2:3,2:4),DIM=2,N(2:3,2:4).NE.0) yields [5,1].
NAME
MOD, AMOD, DMOD, QMOD, IMOD, JMOD, KMOD – Computes remainder
SYNOPSIS
MOD ([A=]a,[P=]p)
AMOD ([A=]a,[P=]p)
DMOD ([A=]a,[P=]p)
QMOD ([A=]a,[P=]p)
IMOD ([A=]a,[P=]p)
JMOD ([A=]a,[P=]p)
KMOD ([A=]a,[P=]p)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: IMOD, JMOD, KMOD, QMOD
DESCRIPTION
These intrinsic functions compute the remainder of a / p. MOD is the generic function name; the others are
specifics. These are elemental intrinsic functions. They accept the following arguments:
a Must be of type integer or real.
p Must be of the same type and kind type as a. The result is undefined if p is zero.
These functions evaluate y = a - p * INT(a/p).
NOTES
The MOD, AMOD, and DMOD intrinsic function names can be passed as arguments; the others cannot.
RETURN VALUES
MOD returns the integer remainder of its integer arguments.
AMOD returns the single-precision real remainder of its single-precision real arguments.
DMOD returns the double-precision real remainder of its double-precision real arguments.
QMOD returns the quad-precision real remainder of its quad-precision real arguments.
IMOD returns the integer (KIND=2) remainder of its integer (KIND=2) arguments.
JMOD returns the integer (KIND=4) remainder of its integer (KIND=4) arguments.
KMOD returns the integer (KIND=8) remainder of its integer (KIND=8) arguments.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
EXAMPLES
The following examples show the results of calling MOD with all possible combinations of positive and
negative integers:
• MOD(7,4) yields 3.
• MOD(-7,4) yields -3.
• MOD(7,-4) yields 3.
• MOD(-7,-4) yields -3.
NAME
MODELS – Describes mathematical representation models for CF90 and MIPSpro 7 Fortran 90 compiler
intrinsic procedures
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The compilers implement the intrinsic procedures according to the representation models described in the
Fortran standard. The Fortran standard describes a bit model, an integer model, and a real number model.
For more information on these models, see the Fortran Language Reference Manual, Volume 2.
Bit model
The bit model interprets a nonnegative scalar data object of type integer as a sequence of binary digits (bits).
In the model, w k has a value of 0 or 1. A bit is defined to be a binary digit w located at position k of a
nonnegative integer scalar object, which is based on the following nonnegative integer model:
s −1
Σ
k
j= wk2
k =0
Object Definition
j The integer value.
s The number of bits in the model. The bits are numbered from right to left beginning with 0.
wk A bit is a binary digit, w, located at position k. Either 0 or 1.
For 64-bit integers, the values in the model are as follows:
Object Value
s 64
k 0 through 63
On UNICOS systems, a 46-bit integer is stored in a 64-bit storage container.
For 32-bit integers, the values are as follows:
Object Value
s 32
k 0 through 31
You can use the BIT_SIZE intrinsic function to determine the value of s in the model.
The bit manipulation functions are based upon this bit model. The model deals only with nonnegative
integers interpreted through these functions and the MVBITS subroutine. It is not necessarily related to the
implementation of the integer data type. It also is independent of the binary, octal, and hexadecimal (BOZ)
constants described in the Fortran Language Reference Manual, Volume 1.
Integer model
The integer number system model is as follows:
q
i = s × Σ wkr
k-1
k =1
This equation assumes the following definitions:
Object Definition
i The integer value.
s The sign. Either +1 or – 1.
r The radix. An integer greater than 1.
q The number of digits. An integer greater than 0.
wk The kth digit. An integer 0 ≤ w k < r.
For 64-bit integers, the values in the model are as follows:
Object Value
r 2
q 63
k An integer 1 ≤ k ≤ 63, and the sign bit
For 32-bit integers on UNICOS/mk and IRIX systems, the values in the model are as follows:
Object Value
r 2
q 31
k An integer 1 ≤ k ≤ 31, and the sign bit
For 8-bit integers on IRIX systems, the values in the model are as follows:
Object Value
r 2
q 7
k An integer 1 ≤ k ≤ 7, and the sign bit
For 16-bit integers on IRIX systems, the values in the model are as follows:
Object Value
r 2
q 15
k An integer 1 ≤ k ≤ 15, and the sign bit
The values shown for the integer number system model can be retrieved through the DIGITS, RANGE, and
RADIX numeric inquiry intrinsic functions. The DIGITS function returns the number of significant digits
(q) for an integer in the model, and the RANGE function returns the decimal number of significant digits.
The RADIX function returns the base of the model (r).
The HUGE numeric inquiry intrinsic function returns the largest positive number in the integer number
system model.
Real model
The real number system model is as follows:
x=0
or
p
Σ
e -k
x=s×b × fkb
k =1
This equation assumes the following definitions:
Object Definition
x The real value.
s The sign. Either +1 or – 1.
b The base (real radix). An integer greater than 1.
e An integer between some minimum and maximum value.
p The number of mantissa digits. An integer greater than 1.
fk The kth digit. An integer 1 ≤ f k < b. f 1 can be 0 only if all f k are 0.
For 128-bit real numbers on UNICOS systems, the values in the model are as follows:
Object Value
b 2
e max 8189
e min – 8188
p 95
k An integer 1 ≤ k ≤ 95
For 128-bit real numbers on IRIX systems systems, the values in the model are as follows:
Object Value
b 2
e max 1023
e min – 967
p 107
k An integer 1 ≤ k ≤ 107
For 128-bit real numbers on Cray T90 systems that support IEEE floating-point arithmetic, the values in the
model are as follows:
Object Value
b 2
e max 16384
e min – 16381
p 113
k An integer 1 ≤ k ≤ 113
For 64-bit real numbers on UNICOS systems, the values in the model are as follows:
Object Value
b 2
e max 8189
e min – 8188
p 47
k An integer 1 ≤ k ≤ 47
For 64-bit real numbers on IRIX systems, on Cray T90 systems that support IEEE floating-point arithmetic,
and on UNICOS/mk systems, the values in the model are as follows:
Object Value
b 2
e max 1024
e min – 1021
p 53
k An integer 1 ≤ k ≤ 53
For 32-bit real numbers on UNICOS/mk and IRIX systems, the values in the model are as follows:
Object Value
b 2
e max 128
e min – 125
p 24
k An integer 1 ≤ k ≤ 24
The values shown for the real number system model can be retrieved through the RADIX, MAXEXPONENT,
MINEXPONENT, DIGITS, PRECISION, and RANGE numeric inquiry intrinsic functions.
The HUGE and TINY numeric inquiry intrinsic functions return the largest and the smallest positive number
in the real number system model. The EPSILON function returns a positive real number that is epsilon =
1– p
b .
NOTES
On UNICOS systems, both execution speed and the number of bits used in mathematical operations are
affected when compiling with f90 -O fastint, which is the default setting. For more information, see
CF90 Commands and Directives Reference Manual.
NAME
MODULO – Modulo function
SYNOPSIS
MODULO ([A=]a, [P=]p)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MODULO function returns the remainder of a divided by p using modulo math. The result always has
the sign of the modulo base, p.
This function accepts the following arguments:
a Must be of type integer or real
p Must be of the same type and kind type parameter as a
MODULO is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type and type parameter are the same as a.
When a is of type integer, if p is not equal to zero, MODULO (a, p) has the value r such that a = q × p + r,
where q is an integer. The inequality 0 ≤ r < p holds if p > 0, and p < r ≤ 0 holds if p < 0. If p = 0, the
result is 0.
When a is of type real, if p is not equal to zero, the value of the result is a - FLOOR (a / p) * p. The result
can be a NaN when that value is available.
EXAMPLES
Example 1. MODULO(8,5) yields 3.
Example 2. MODULO(-8,5) yields 2.
Example 3. MODULO(8,-5) yields -2.
NAME
MVBITS – Copies a sequence of bits from one integer data object to another
SYNOPSIS
CALL MVBITS ([FROM=]from, [FROMPOS=]frompos, [LEN=]len, [TO=]to, [TOPOS=]topos)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The MVBITS intrinsic subroutine copies a sequence of bits from one integer data object to another. It
accepts the following arguments:
from Must be of type integer. It is an INTENT (IN) argument.
frompos Must be of type integer and nonnegative. It is an INTENT (IN) argument. frompos + len
must be less than or equal to BIT_SIZE (from). The bit model defines the interpretation of an
integer value as a sequence of bits. For more information on the bit model see the MODELS(3I)
man page.
len Must be of type integer and nonnegative. It is an INTENT (IN) argument.
to Must be a variable of type integer with the same kind type parameter value as from and may be
the same variable as from. It is an INTENT (INOUT) argument. to is set by copying the
sequence of bits of length len, starting at position frompos of from to position topos of to. No
other bits of to are altered. On return, the len bits of to starting at topos are equal to the value
that the len bits of from starting at frompos had on entry.
topos Must be of type integer and nonnegative. It is an INTENT (IN) argument. topos + len must
be less than or equal to BIT_SIZE (to).
MVBITS is an elemental subroutine. The name of this intrinsic cannot be passed as an argument.
EXAMPLES
If TO has the initial value 6, the value of TO after the statement CALL MVBITS(7, 2, 2, TO, 0) is
5.
SEE ALSO
MODELS(3I)
NAME
_my_pe, MY_PE – Returns the processing element (PE) number of the calling PE
SYNOPSIS
C/C++:
#include <intrinsics.h>
int _my_pe (void);
Fortran on UNICOS and IRIX systems:
I= MY_PE ()
Fortran on UNICOS/mk systems:
INTRINSIC MY_PE
I= MY_PE ()
IMPLEMENTATION
C/C++: UNICOS/mk systems
Fortran: UNICOS, UNICOS/mk, IRIX systems
Cray C/C++, CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
This function returns the processing element (PE) number of the calling PE. It accepts no arguments. The
result is an integer between 0 and npes - 1, where npes is the total number of PEs executing the current
program.
NOTES
C/C++
Because _my_pe is an intrinsic function, no externally visible library function is available for it. The
compiler generates inline code to produce the result.
Fortran
Whether this function is intrinsic depends on your platform, as follows:
• On UNICOS and IRIX systems, it is supported as part of the Message Passing Toolkit, and it is supported
as an external function.
SEE ALSO
sysconf(2)
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
NEAREST – Returns the nearest different machine representable number in a given direction
SYNOPSIS
NEAREST ([X=]x, [S=]s)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The NEAREST intrinsic function returns the nearest different machine representable number in a given
direction. It accepts the following arguments:
x Must be of type real
s Must be of type real and not equal to zero
NEAREST is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type and type parameter are the same as x. The result has a value equal to the machine
representable number distinct from x and nearest to it in the direction of the infinity with the same sign as s.
NOTES
On Cray T90 systems that support IEEE arithmetic, this intrinsic vectorizes inline for 64-bit operands and
calls to scalar-only library routines for 128-bit operands.
EXAMPLES
-46
NEAREST(3.0,2.0) yields 3 + 2 on UNICOS systems according to the real number system model.
-22
NEAREST(3.0,2.0) yields 3 + 2 on UNICOS/mk and IRIX systems, according to the real number
system model.
For more information on the real number model, see the MODELS(3I) man page.
SEE ALSO
MODELS(3I)
NAME
NINT, IDNINT, IQNINT – Converts to nearest integer
SYNOPSIS
NINT ([A=]a [,[KIND=]kind])
IDNINT ([A=]a)
IQNINT ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: IQNINT
DESCRIPTION
NINT is the generic function name; the others are specifics. These are elemental intrinsic functions. They
accept the following arguments:
a Must be type real. See the RETURN VALUES section for information on input data types and
return values.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
kind An integer scalar value. Must be a kind type allowed for a. This argument is not accepted by
the MIPSpro Fortran 77 compiler.
These functions find the nearest integer for real numbers, using these equations:
• If a ≥ 0, y = INT(a+.5).
• If a < 0, y = INT(a-.5).
NOTES
The NINT and IDNINT intrinsic function names can be passed as arguments; the other cannot.
RETURN VALUES
NINT returns the nearest integer for its real argument.
IDNINT returns the nearest integer for its double-precision argument.
IQNINT returns the nearest integer for its quad-precision argument.
NAME
NOT, INOT, JNOT, KNOT – Performs a logical complement
SYNOPSIS
NOT ([I=]i)
INOT ([I=]i)
JNOT ([I=]i)
KNOT ([I=]i)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: INOT, JNOT, KNOT
DESCRIPTION
The NOT, INOT, JNOT, and KNOT intrinsic functions perform a logical complement. They accept the
following argument:
i Must be of type integer. For INOT, must be of type integer (KIND=2). For JNOT, must be of
type integer (KIND=4). For KNOT, must be of type integer (KIND=8).
These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
The result type and type parameter are the same as i. On IRIX systems, the result can be affected by the -i
option on the f90(1) command line.
The result has the value obtained by complementing i bit-by-bit according to the following truth table:
i NOT(i)
1 0
0 1
The bit model defines the interpretation of an integer value as a sequence of bits. For more information on
the bit model, see the MODELS(3I) man page.
EXAMPLES
If I is represented by the string of bits 01010101, NOT(I) has the binary value 10101010.
SEE ALSO
f90(1)
MODELS(3I)
NAME
NULL – Returns a disassociated pointer
SYNOPSIS
NULL ([[MOLD=]mold])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The NULL intrinsic function returns a disassociated pointer. It accepts the following argument:
mold A pointer of any type. This is an optional argument. Its pointer association status can be
undefined, disassociated, or associated. If its status is associated, the target need not be defined
with a value.
mold must be specified when a reference to NULL appears as an actual argument in a reference
to a generic procedure if the type, type parameters, or rank is required to resolve the generic
reference.
This is a transformational function.
RETURN VALUES
NULL returns a disassociated pointer. The pointer has no shape, but it does have rank.
If mold is specified, the return value has the same characteristics as mold.
If mold is not specified, the data type, type parameters, and rank of the result are determined by the pointer
that becomes associated with the result, as follows:
Appearance of NULL: Result type, type parameters, rank:
Right side of a pointer assignment Pointer on the left side
Initialization for an object in a declaration The object
Default initialization for a component The component
In a structure constructor The corresponding component
As an actual argument The corresponding dummy argument
In a DATA statement The corresponding pointer object
EXAMPLES
NAME
_numargs, _argcount, NUMARG – Returns the number of arguments in a function or subprogram call
SYNOPSIS
C/C++:
#include <intrinsics.h>
int _numargs (void);
int _argcount (void);
Fortran:
NUMARG ()
IMPLEMENTATION
C/C++:
_numargs is available on UNICOS and UNICOS/mk systems
_argcount is available on Cray T90 and UNICOS/mk systems only
Fortran: UNICOS and UNICOS/mk systems
Cray C++, CF90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
C/C++
The _argcount function returns the number of arguments explicitly passed by the user to the function in
which the call appears excluding any "hidden" arguments added by the compiler. The _numargs function
returns the total number of words in the argument list passed to the function in which the call appears
including any "hidden" arguments added by the compiler. "Hidden" arguments include the this pointer for
member functions in C++ and the aggregrate return value pointer used for functions returning class,
struct, or union.
If either of these intrinsic functions are called from within an inline function, the return value is undefined.
For this reason, these intrinsic functions should never be called from within a file compiled with an
automatic inlining level greater than 0.
Fortran
This intrinsic function returns the number of arguments in a subprogram call. It accepts no arguments.
The name of this intrinsic cannot be passed as an argument.
NOTES
C/C++
Because these are intrinsic functions, no externally visible library functions are available for them. The
compiler generates inline code to produce the result.
Fortran
In Fortran, the NUMARG intrinsic function is outmoded. Refer to the Fortran Language Reference Manual,
Volume 3, for information on outmoded features and their preferred standard alternatives.
EXAMPLES
C/C++: The following example demonstrates the use of the _argcount and _numargs intrinsic
functions:
Program source:
#include <stdio .h>
main()
{
f(10, ss) ;
}
Execution output:
number of argume nts pas sed to f = 2
number of words in arg ume nt lis t pas sed to f = 11
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
NUM_IMAGES – Retrieves total number of images executing
SYNOPSIS
NUM_IMAGES()
IMPLEMENTATION
UNICOS/mk systems
CF90
STANDARDS
Fortran extension
DESCRIPTION
NUM_IMAGES is an intrinsic procedure that retrieves the total number of images that are executing. It is an
inquiry function.
RETURN VALUES
The NUM_IMAGES intrinsic function returns a scalar value of type default integer.
SEE ALSO
CF90 Co-array Programming Manual
NAME
_num_pes, NUM_PES – Returns the number of processing elements (PEs) running in an application
SYNOPSIS
C or C++:
#include <intrinsics.h>
int _num_pes (void);
Fortran:
I = NUM_PES()
IMPLEMENTATION
C/C++: UNICOS and UNICOS/mk
Fortran: UNICOS, UNICOS/mk, and IRIX systems
Cray C/C++, CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
The num_pes function returns the number of PEs running in an application.
C/C++ NOTES
The _num_pes intrinsic function is evaluated at run-time and cannot be used in constant expressions.
Because _num_pes is an intrinsic function, no externally visible library function is available for it. The
compiler generates inline code to produce the result.
SEE ALSO
intro_shmem(3), my_pe(3I), start_pes(3)
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
Message Passing Toolkit: PVM Programmer’s Manual
Message Passing Toolkit: MPI Programmer’s Manual
NAME
OR – Computes logical sum
SYNOPSIS
OR ([I=]i,[J=]j)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extension
DESCRIPTION
OR is an elemental function. It accepts the following arguments:
i Must be of type Boolean, integer, real, Cray pointer, or logical.
j Must be of type Boolean, integer, real, Cray pointer, or logical.
NOTES
This is an outmoded routine. Refer to the Fortran Language Reference Manual, Volume 3, for information
about outmoded features and their preferred standard alternatives.
The name of this intrinsic cannot be passed as an argument.
CAUTIONS
Unexpected results can occur when Boolean functions are declared external and then used with logical
arguments. The external Boolean functions always treat their arguments as type Boolean and return a
Boolean result on UNICOS and UNICOS/mk systems. On IRIX systems, they return an integer result.
RETURN VALUES
When given two arguments of type logical, OR computes a logical sum and returns a logical result.
When given two arguments of type integer, real, Boolean, or pointer, OR computes a bit-wise logical sum
and returns a Boolean result. No type conversion occurs.
The following tables show both the logical sum and bit-wise logical sum:
T T T
T F T
F T T
F F F
1 1 1
1 0 1
0 1 1
0 0 0
EXAMPLES
The following section of Fortran code shows the OR function used with two arguments of type logical:
LOG ICAL L1, L2, L3
...
L3 = OR(L1, L2)
The following section of Fortran code shows the OR function used with two arguments of type integer. The
bit patterns of the arguments and result are also shown. For clarity, only the rightmost 8 bits are shown.
INT EGER I1, I2, I3
I1 = 12
I2 = 10
...
I3 = OR(I1, I2)
------ ------ --- --- --- --- --- --- - --- --- --- --- --- --- --- --- --- ----
| 0 | | | | | | | | | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 |
------ ------ --- --- --- --- --- --- - --- --- --- --- --- --- --- --- --- ----
I1 I2
NAME
PACK – Packs an array into an array of rank one under control of a mask
SYNOPSIS
PACK ([ARRAY=]array, [MASK=]mask [,[VECTOR=]vector])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The PACK intrinsic function packs an array into an array of rank one under control of a mask. It can be
used for array construction. It accepts the following arguments:
array Can be of any type. It must not be scalar.
mask Must be of type logical and must be conformable with array.
vector Must be of the same type as array and must have rank one. vector must have at least as many
elements as there are true elements in mask. If mask is scalar with the value true, vector must
have at least as many elements as there are in array.
PACK is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is an array of rank one of the same type as array. If vector is present, the result size is that of
vector; otherwise, the result size is the number t of true elements in mask unless mask is scalar with the
value true in which case the result size is the size of array.
Element i of the result is the element of array that corresponds to the ith true element of mask, taking
elements in array element order, for i=1, 2, . . ., t. If vector is present and has size n>t, element i of the
result has the value vector(i), for i=t+1, . . ., n.
EXAMPLES
Example 1: Assume that N = (/1,-1,3/). The following are true:
• PACK(N,MASK=N.LT.0) yields (/-1/).
• PACK(N,MASK=.TRUE.) yields (/1,-1,3/).
NAME
_pbit, _pbits – Returns the value of a data word
SYNOPSIS
#include <intrinsics.h>
long _pbit (long x, long n, long y);
long _pbits (long x, long m, long n, long y);
IMPLEMENTATION
UNICOS, UNICOS/mk systems
Cray C/C++
STANDARDS
C/C++ extension
DESCRIPTION
The _pbit function returns the value consisting of x with its nth bit (from the right) set to the rightmost bit
of data word y.
The _pbits function returns the value consisting of x with m bits changed, starting at bit n (from the right
and counting to the left), to equal the rightmost m bits of y.
These functions accept the following variables:
x The data word from which the value is extracted.
m A value in the range of 0 through 63.
n A value in the range of 0 through 63.
NOTES
Because these are intrinsic functions, no externally visible library functions are available for them. The
compiler generates inline code to produce the result.
EXAMPLES
Program source:
main()
{
lon g x = 0;
lon g y = 0x0 123 456 789 abc def ;
printf ("_pbi t(x , 10, y) = %lx \n" , _pb it( x, 10, y)) ;
pri ntf ("_ pbi ts( x, 12, 32, y) = %lx \n", _pbits (x, 12, 32, y)) ;
}
Execution output:
_pb it( x, 10, y) = 400
_pb its (x, 12, 32, y) = def 000 000 00
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
_popcnt, POPCNT – Counts number of set bits
SYNOPSIS
C/C++:
#include <intrinsics.h>
int _popcnt (long i);
Fortran:
POPCNT ([I=]i)
IMPLEMENTATION
C/C++: UNICOS and UNICOS/mk systems
Fortran: UNICOS, UNICOS/mk, IRIX systems
Cray C/C++, CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
C/C++
The _popcnt function returns the number of bits set to 1 (the population count) in argument i.
Fortran
This intrinsic function counts the number of bits set in the argument. It accepts the following argument:
i A Boolean, integer, real, or Cray pointer value. i cannot be declared as REAL(KIND=16).
POPCNT is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
A vector version of the POPCNT intrinsic function exists on UNICOS and UNICOS/mk systems. On
UNICOS/mk systems, the vector version of this intrinsic is used when -O vector3 or -O 3 are specified
on the compiler command line.
C/C++
Because _popcnt is an intrinsic function, no externally visible library function is available for it. The
compiler generates inline code to produce the result.
Fortran
The bit representation of the logical data type is not consistent among UNICOS and UNICOS/mk systems.
For further details, see your compiler’s reference manuals.
EXAMPLES
Fortran: The following section of Fortran code shows the POPCNT function used with an argument of type
integer. The bit pattern of the argument and the value of the result are also given. For simplicity, a 16-bit
object is used.
INT EGE R I1, I2
...
I2 = POP CNT (I1)
--- --- ------ --- --- ------ ------ ------ ------ ------ ------ ------ ---
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 |
--- --- ------ --- ------ ------ ------ ------ ------ ------ ------ ------
I1
The POPCNT function returns the value 6 to the integer variable I2.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
_poppar, POPPAR – Computes bit population parity
SYNOPSIS
C/C++:
#include <intrinsics.h>
int _poppar (long i);
Fortran:
POPPAR ([I=]i)
IMPLEMENTATION
C/C++: UNICOS and UNICOS/mk systems
Fortran: UNICOS, UNICOS/mk, IRIX systems
Cray C/C++, CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
C/C++
The _poppar function returns 0 if the argument i has an even number of bits that are set to 1. This is the
parity of the population count for argument i.
Fortran
This intrinsic function computes the bit population parity and returns an integer value. It accepts the
following argument:
i A Boolean, integer, real, or Cray pointer value. i cannot be declared as REAL(KIND=16).
POPPAR is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
The bit representation of the logical data type is not consistent among UNICOS and UNICOS/mk systems.
For further details, see your compiler’s reference manuals.
C/C++
Because _poppar is an intrinsic function, no externally visible library function is available for it. The
compiler generates inline code to produce the result.
EXAMPLES
The following section of Fortran code shows the POPPAR function used with an argument of type integer.
The bit pattern of the argument and the value of the result are also given. For simplicity, a 16-bit object is
used.
INTEGER I1, I2
...
I2 = POPPAR(I1 )
--- --- ------ --- --- ------ ------ ------ ------ ------ ------ ------ ---
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 |
--- --- ------ --- ------ ------ ------ ------ ------ ------ ------ ------
I1
The POPPAR function returns the value 0 to the integer variable I2.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
PRECISION – Returns the decimal precision of a number in the real number model
SYNOPSIS
PRECISION ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The PRECISION intrinsic function returns the decimal precision of a number in the real number model.
The real number model is described in the MODELS(3I) man page. This function accepts the following
argument:
x Must be of type real or complex. It may be scalar or array valued.
PRECISION is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a default integer scalar. The result has the value INT((p– 1)*LOG10(b))+k, where b and p are
as defined in the model and where k is 1 if b is an integral power of 10 and 0 otherwise.
EXAMPLES
On UNICOS systems, except for Cray T90 systems that support IEEE floating-point arithmetic,
PRECISION(X) yields 13 for REAL(KIND=8).
On Cray T90 systems that support IEEE floating-point arithmetic, PRECISION(X) yields the following
values:
• 6 for REAL(KIND=4) X
• 15 for REAL(KIND=8) X
• 33 for REAL(KIND=16) X
On IRIX systems, PRECISION(X) yields the following values:
• 6 for REAL(KIND=4) X
• 15 for REAL(KIND=8) X
• 31 for REAL(KIND=16) X
NAME
PRESENT – Determines whether an optional argument is present
SYNOPSIS
PRESENT ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The PRESENT intrinsic function determines whether an optional dummy argument is present. It accepts the
following argument:
a Must be an optional dummy argument of the procedure in which the PRESENT function
reference appears
PRESENT is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type is a default logical scalar. The result has the value TRUE if a is present and otherwise has
the value FALSE.
NAME
PRODUCT – Forms the product of array elements
SYNOPSIS
PRODUCT ([ARRAY=]array [,[DIM=]dim] [,[MASK=]mask])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The PRODUCT intrinsic function forms the product of all the elements of array along dimension dim
corresponding to the true elements of mask. It accepts the following arguments:
array Must be of type integer, real, or complex. It must not be scalar.
dim Must be scalar and of type integer with a value in the range 1 ≤ dim ≤ n, where n is the rank of
array. The corresponding actual argument must not be an optional dummy argument.
mask Must be of type logical and must be conformable with array.
PRODUCT is a transformational intrinsic function. The name of this intrinsic cannot be passed as an
argument.
RETURN VALUES
The result has the same type and type parameter as array. The result is scalar if dim is absent or array has
rank one; otherwise, the result is an array of rank n– 1 of shape (d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ), where
(d 1 , d 2 , . . ., d n ) is the shape of array.
The result of PRODUCT(array) has a value equal to the product of all the elements of array or has the
value 1 if array has size 0.
The result of PRODUCT(array,MASK=mask) has a value equal to the product of the elements of array
corresponding to the true elements of mask or has the value 1 if there are no true elements.
If array has rank one, PRODUCT(array,dim[,mask]) has a value equal to that of
PRODUCT(array[,MASK=mask]). Otherwise, the value of element (s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ) of
PRODUCT(array,dim[,mask]) is equal to PRODUCT(array (s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n ))
[, MASK=mask (s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )]).
EXAMPLES
Example 1: PRODUCT((/1,2,3/)) yields 6.
Example 2: PRODUCT(C,MASK=C.GT.0.0) yields the product of the positive elements of C.
Example 3: Assume that B is the following array:
135
246
PRODUCT(B,DIM=1) yields (/2,12,30/).
PRODUCT(B,DIM=2) yields (/15,48/).
NAME
RADIX – Returns the base number from the real or integer number models
SYNOPSIS
RADIX ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The RADIX intrinsic function returns the base number of the model (either real or integer) that represents
numbers of the same type and kind type parameter as the argument specified. For more information on the
real number model and the integer number model, see the MODELS(3I) man page. It accepts the following
argument:
x Must be of type integer or real. It may be scalar or array valued.
RADIX is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a default integer scalar. The result has the value r if x is of type integer and the value b if x is
of type real, where r and b are as defined in the model.
EXAMPLES
RADIX(x) yields 2 for any x.
SEE ALSO
MODELS(3I)
NAME
_ranf, RANF, RANGET, RANSET – Computes pseudo-random numbers
SYNOPSIS
C/C++:
#include <intrinsics.h>
double _ranf(void);
Fortran:
RANF()
RANGET ([I=]i)
RANSET ([K=]k)
Fortran on UNICOS/mk systems only:
RANSET ([K=]k [, [J=]j])
IMPLEMENTATION
C/C++: UNICOS and UNICOS/mk systems
Fortran: UNICOS, UNICOS/mk, IRIX systems
Cray C/C++, CF90, MIPSpro 7 Fortran 90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
The _ranf and RAND functions return a pseudo-random floating-point number in the range of 0.0 < x < 1.0.
The RANGET intrinsic procedure returns a seed from the random number seed table.
The RANSET function establishes a seed in the random number seed table.
NOTES
C/C++
Because _ranf is an intrinsic function, no externally visible library function is available for it.
Fortran
RANF obtains the first or next in a series of pseudo-random numbers. Parenthesis are required, that is:
var = RANF(). If an argument is supplied, it is ignored.
The RANGET intrinsic function obtains a seed. It can be called as a function or a subroutine; it is
recommended that this routine be used as a function because it is not considered intrinsic when called as a
subroutine. RANGET has an optional integer argument. If present, the argument is set to the seed. The
argument for RANGET is as follows:
i An integer of default kind (KIND=8). If present, RANGET returns the seed in i.
On UNICOS and UNICOS/mk systems, the RANSET intrinsic function establishes a seed by using the lower
48 bits of the argument. The result type is typeless. If no argument or a zero argument is supplied, the seed
is reset to an initial default value. When the seed of the random number generator is reset, RANSET does
not store the supplied argument as the first value in the buffer of the random number seeds. If an argument
is supplied, the lower 48 bits are used as the random-number seed. The rightmost bit is always set to 1.
The RANSET arguments are as follows:
k An optional integer, real, or Boolean argument of default kind (KIND=8) The range of argument k is
k < inf, where inf is as follows:
• On UNICOS systems, infinity is approximately 10 2450 .
• On UNICOS/mk and IRIX systems, infinity is approximately 10 308 .
j An optional integer argument that, if specified, is used as a count for skipping the first section of
sequential random numbers. You can use this to create a complete sequence of random numbers while
running on many PEs by breaking up the sequence into subsequences and using RANSET() to get each
subsequence started in the correct location.
The names of these intrinsics cannot be passed as arguments.
The RANF Algorithm
In Fortran on Cray C90 systems, the random number generation algorithm uses the following two equations:
• S(n+1) = M1*S(n) mod 2**48
• S(n+64) = M64*S(n) mod 2**48
Each S(i) is the ith seed.
The first equation is used to generate the first 128 random numbers and store them in a table if a call to
RANSET() was done. Otherwise, the table contains the first 128 random numbers from the default seed.
The second equation is used because it vectorizes.
The default seed is S(0) = 1274321477413155 (octal).
The operations M1*S(n) and M64*S(n) are done as integer multiplications in such a way to preserve the
lower 48 bits. It is the lower 48 bits that make the next random number seed and are used in the return
value.
The return value (random number) is the newly generated seed with an exponent of 40000 (octal) added.
This is normalized before exit.
The multiplier M1 is 1207264271730565 (octal) and is related to M64 by the following expression:
M64 = lower 48 bits of M1**64 = 7027423346125401 (octal).
For example, the following Fortran program, when compiled with the f90 -i 64 option on a Cray C90
system, is the equivalent of the RANF function:
cc
c THI S IS A FOR TRA N VER SIO N OF RAN F() FUN CTI ON
cc
REA L FUN CTI ON RAN F()
REA L NOR M
INT EGE R MHI ,MLO,E XPO,SE ED,SEE DHI,SE EDL O
DAT A SEE D/1 274321477 413155 B/
SAV E SEE D
SEE DHI = SHIFTR (AND(S HIFTL( 777777 77B ,24 ),S EED),2 4)
SEE DLO = AND (77 777 777 B,S EED )
On IRIX systems, RANF uses a 64-bit linear congruential generator with a default seed of
1274321477413155 (octal).
RETURN VALUES
_ranf and RANF return a 64-bit floating-point number in the range 0.0 < x < 1.0.
RANGET returns a 64-bit integer result.
RANSET returns a 64-bit typeless result.
EXAMPLES
The following examples are written in Fortran:
DO 10 I=1 ,10
10 RAN DOM(I) =RA NF()
iseed=RA NGET(ivalue)
SEE ALSO
RANDOM_NUMBER(3I), RANDOM_SEED(3I)
rand(3C) in the UNICOS System Libraries Reference Manual
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
RANDOM_NUMBER – Returns pseudorandom numbers
SYNOPSIS
CALL RANDOM_NUMBER ([HARVEST=]harvest)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The RANDOM_NUMBER intrinsic subroutine returns one pseudorandom number or an array of pseudorandom
numbers from the uniform distribution over the range 0 ≤ x < 1. It accepts the following argument:
harvest Must be of type real. It is an output argument. It may be a scalar or an array variable. It is set
to contain pseudorandom numbers from the uniform distribution in the interval 0 ≤ x < 1.
On UNICOS and UNICOS/mk systems, harvest is 64 bits. On IRIX systems, harvest is 32 bits.
The name of this intrinsic cannot be passed as an argument.
EXAMPLES
REA L X, Y(10,1 0)
! Initia lize X wit h a pse udo ran dom num ber
CAL L RAN DOM_NU MBE R(H ARV EST =X)
CAL L RAN DOM_NU MBE R(Y )
! X and Y contai n uni for mly dis tri but ed ran dom num ber s
SEE ALSO
RANDOM_SEED(3I), RANF(3I)
NAME
RANDOM_SEED – Restarts or queries the pseudorandom number generator
SYNOPSIS
CALL RANDOM_SEED ([[SIZE=]size] [,[PUT=]put] [,[GET=]get])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The RANDOM_SEED intrinsic subroutine restarts or queries the pseudorandom number generator used by
RANDOM_NUMBER. It accepts the following arguments (note that there must be exactly one argument or no
arguments present):
size Must be scalar and of type integer. It is an output argument. It is set to the number N of
integers that the processor uses to hold the value of the seed.
put Must be an integer array of rank one and size ≥ N. It is an input argument. It is used to set the
seed value.
get Must be an integer array of rank one and size ≥ N. It is an output argument. It is set to the
current value of the seed.
The name of this intrinsic cannot be passed as an argument.
EXAMPLES
SEE ALSO
RANDOM_NUMBER(3I)
NAME
RANGE – Returns the decimal exponent range of a number according to the real or integer model
SYNOPSIS
RANGE ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The RANGE intrinsic function returns the decimal exponent range in the model representing integer or real
numbers with the same kind type parameter as the argument. For information on integer number model or
the real number model, see the MODELS(3I) man page. It accepts the following argument:
x Must be of type integer, real, or complex. It may be scalar or array valued.
RANGE is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a default integer scalar.
For an integer argument, the result has the value INT(LOG10(huge)), where huge is the largest positive
integer in the model representing integer numbers with same kind type parameter as x.
For a real or complex argument, the result has the value INT(MIN(LOG10(huge),-LOG10(tiny))),
where huge and tiny are the largest and smallest positive numbers in the model representing real numbers
with the same value for the kind type parameter as x.
EXAMPLES
On UNICOS systems, except for Cray T90 systems that support IEEE floating-point arithmetic, RANGE(x)
yields the value 2465 for real x.
On IRIX systems, RANGE(x) yields the following values:
• 37 for real (KIND=4) x
• 307 for real (KIND=8) x
• 291 for real (KIND=16) x
NAME
_readSB, _readST, _writeSB, _writeST – Returns status register value
SYNOPSIS
#include <intrinsics.h>
int _readSB (long n);
long _readST (long n);
void _writeSB (long n, long x);
void _writeST (long n, long x);
IMPLEMENTATION
UNICOS systems
Cray C/C++
STANDARDS
C/C++ extension
DESCRIPTION
The _readSB function returns the value of shared-B register n.
The _readST function returns the value of shared-T register n.
The _writeSB function writes the value of data word x to shared-B register n.
The _writeST function writes the value of data word x to shared-T register n.
These functions accept the following arguments:
n Value n must be a constant in the range 0 through 7.
x x is a data word.
NOTES
Because these are intrinsic functions, no externally visible library functions are available for them. The
compiler generates inline code to produce the result.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
_readSR – Returns status register value
SYNOPSIS
#include <intrinsics.h>
long _readSR (0);
IMPLEMENTATION
UNICOS systems
Cray C/C++
STANDARDS
C/C++ extension
DESCRIPTION
The _readSR function returns the value of status register 0. The only argument allowed is the constant
value 0.
NOTES
Because _readSR is an intrinsic function, no externally visible library function is available for it. The
compiler generates inline code to produce the result.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
REAL, DREAL, QREAL, FLOAT, FLOATI, FLOATJ, FLOATK, DFLOAT, DFLOATI, DFLOATJ, DFLOATK,
QFLOAT, QFLOATI, QFLOATJ, QFLOATK, SNGL, SNGLQ – Converts to type real
SYNOPSIS
REAL ([A=]a [,[KIND=]kind])
DREAL ([A=]a)
QREAL ([A=]a)
FLOAT ([A=]a)
FLOATI ([A=]a)
FLOATJ ([A=]a)
FLOATK ([A=]a)
DFLOAT ([A=]a)
DFLOATI ([A=]a)
DFLOATJ ([A=]a)
DFLOATK ([A=]a)
QFLOAT ([A=]a)
QFLOATI ([A=]a)
QFLOATJ ([A=]a)
QFLOATK ([A=]a)
SNGL ([A=]a)
SNGLQ ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: DREAL, QREAL, FLOAT, FLOATI, FLOATJ, FLOATK, DFLOAT, DFLOATI,
DFLOATJ, DFLOATK, QFLOAT, QFLOATI, QFLOATJ, QFLOATK, SNGLQ
DESCRIPTION
These intrinsic functions convert specified types to type real. These are elemental intrinsic functions. They
accept the following arguments:
a For REAL, DREAL, and QREAL, must be type complex, integer, or real. For FLOAT, DFLOAT,
and QFLOAT, must be type integer. For FLOATI, DFLOATI, and QFLOATI, must be type
integer (KIND=2). For FLOATJ, DFLOATJ, and QFLOATJ, must be type integer (KIND=4).
For FLOATK, DFLOATK, and QFLOATK, must be type integer (KIND=8). For SNGL, must be
type double-precision real. For SNGLQ, must be type quad-precision real.
If a is of type complex, an approximation of the real part of a is returned.
The terms single precision, double precision, and quad precision differ depending on your
platform. For platform-specific information, see the TERMINOLOGY section of the
INTRO_INTRIN(3I) man page.
kind An integer scalar value. The kind type to be used for the result. If not specified, the kind type
for default real is used for integer and real arguments. If kind is not present and the argument is
complex, the result has the same kind type as the argument. This argument is not accepted by
the MIPSpro Fortran 77 compiler.
Type conversion routines assign the appropriate type to Boolean arguments without shifting or manipulating
the bit patterns they represent.
NOTES
The names of these intrinsics cannot be passed as arguments.
RETURN VALUES
If a is of type integer or real and kind is specified, the kind type parameter is that specified by kind. If a is
of type integer or real and kind is not specified, the kind type parameter is of type default real.
If a is of type complex and kind is specified, the kind type parameter is that specified by kind. If a if of
type complex and kind is not specified, the kind type parameter is the kind type parameter of a.
REAL returns default real.
DREAL, DFLOAT, DFLOATI, DFLOATJ, and DFLOATK, return double-precision real.
QREAL, QFLOAT, QFLOATI, QFLOATJ, QFLOATK, return quad-precision real.
FLOAT, FLOATI, FLOATJ, FLOATK, SNGL, and SNGLQ return single-precision real.
NAME
REM_IMAGES – Returns MOD(NUM_IMAGES(), 2**LOG2_IMAGES())
SYNOPSIS
REM_IMAGES()
IMPLEMENTATION
UNICOS/mk systems
CF90
STANDARDS
Fortran extension
DESCRIPTION
REM_IMAGES is an intrinsic procedure that returns MOD(NUM_IMAGES(),2**LOG2_IMAGES()). It is
an inquiry function.
RETURN VALUES
The REM_IMAGES intrinsic function returns a scalar value of type default integer.
SEE ALSO
CF90 Co-array Programming Manual
NAME
_remote_write_barrier, REMOTE_WRITE_BARRIER – Blocks processor until remote write
operations have finished
SYNOPSIS
C/C++:
#include <intrinsics.h>
void _remote_write_barrier (void);
Fortran:
REMOTE_WRITE_BARRIER ()
IMPLEMENTATION
UNICOS/mk systems
Cray C/C++, CF90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
This intrinsic blocks the processor until all outstanding remote write request packets have been processed.
NOTES
C/C++
Because _remote_write_barrier is an intrinsic function, no externally visible library function is
available for it. The compiler generates inline code to produce the result.
Fortran
The name of this intrinsic cannot be passed as an argument.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
REPEAT – Concatenates several copies of a string
SYNOPSIS
REPEAT ([STRING=]string, [NCOPIES=]ncopies)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The REPEAT intrinsic function concatenates several copies of a string. It returns the specified number of
concatenated copies of the input string as the result. If the number of copies is zero, the result is a string of
zero length.
REPEAT accepts the following arguments:
string Must be a scalar and of type character.
ncopies Must be either 0 or a positive integer. Must also be a scalar.
REPEAT is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a scalar entity of type character with a length of ncopies times the length of string. The value
of the result is the concatenation of ncopies of string.
If ncopies is zero, the result is a string of zero length.
EXAMPLES
In the following program, a literal with a trailing blank is repeated.
CHARAC TER*14 CHV AR
CHV AR = REPEAT (’S TRI NG ’,2 )
PRI NT ’(3 A)’, ’>’ , CHV AR, ’<’
END
NAME
RESHAPE – Constructs an array of a specified shape
SYNOPSIS
RESHAPE ([SOURCE=]source, [SHAPE=]shape [,[PAD=]pad] [,[ORDER=]order])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The RESHAPE intrinsic function constructs an array of a specified shape from the elements of a given array.
It accepts the following arguments:
source May be of any type. It must be array valued. If pad is absent or of size zero, the size of source
must be greater than or equal to PRODUCT(shape). The size of the result is the product of the
values of the elements of shape.
shape Must be an integer, of rank one, and of constant size. Its size must be positive and less than 8.
It must not have an element whose value is negative.
pad Must be of the same type as source. It must be array valued.
order Must be of type integer. It must have the same shape as shape, and its value must be a
permutation of (1,2,. . .,n), where n is the size of shape. If absent, the default order is (1,2,. . .,n).
RESHAPE is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The type of the result is the same type as source. The result is an array of shape shape, that is,
SHAPE(RESHAPE(source,shape,pad,order)) is equal to shape.
The elements of the result, taken in permuted subscript order order(1), . . ., order(n), are those of source in
normal array element order followed, if necessary, by those of pad in array element order, followed, if
necessary, by additional copies of pad in array element order.
EXAMPLES
Example 1: RESHAPE((/1,2,3,4,5,6/),(/2,3/)) yields the following:
135
246
Example 2: RESHAPE((/1,2,3,4,5,6,7,8,9/),(/3,4/),(/0,0/)) yields the following:
1470
2580
3690
Example 3: RESHAPE((/1,2,3,4,5,6/),(/2,4/),(/0,0/),(/2,1/)) yields the following:
1234
5600
NAME
RRSPACING – Returns the reciprocal of the relative spacing of numeric model numbers near the argument
value
SYNOPSIS
RRSPACING ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The RRSPACING intrinsic function returns the reciprocal of the relative spacing of the numeric real model
numbers near the argument value. For more information on the real number model, see the MODELS(3I)
man page. It accepts the following argument:
x Must be of type real.
RRSPACING is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
This routine is implemented on Cray T90 systems that support IEEE arithmetic by calls to scalar– only
library routines.
RETURN VALUES
The result type and type parameter are the same as x. The result has the value ( (x)(b**-e) ) (b**p) where
b, e, and p are defined in the real number model.
EXAMPLES
The following code was run on several systems:
REAL(KIND =4) R4
REAL(KIND =8) R8
REAL(KIND=16 ) R16
REAL RD
R4=-3.0_4
R8=-3.0_8
R16=-3.0_ 16
RD=-3.0
PRINT *,’ RRSPAC ING R4=’,RRSP ACI NG(R4)
PRINT *,’RRS PAC ING R8= ’,R RSP ACING( R8)
PRINT *,’RRS PAC ING R16 =’, RRS PACING (R1 6)
PRINT *,’ RRSPAC ING RD=’,R RSP ACI NG( RD)
END
On a Cray T90 system that supports IEEE floating-point arithmetic, the results were as follows:
RRSPACING R4= 125829 12.
RRSPAC ING R8= 675 539944 105 574 4.
RRSPAC ING R16 = 7.7 884 452878022 414 427957 444938 30144E +33
RRSPAC ING RD= 675539 944105 574 4.
SEE ALSO
MODELS(3I)
NAME
_rtc, RTC, IRTC, IRTC_RATE – Returns clock register contents
SYNOPSIS
C/C++:
long long _rtc (void);
CF90 and MIPSpro 7 Fortran 90:
RTC ()
IRTC ()
MIPSpro Fortran 77:
IRTC_RATE()
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
Cray C/C++, CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
The _rtc, RTC, and IRTC intrinsic functions return a real-time clock value. The value is expressed as the
number of clock ticks. The IRTC_RATE function returns the clock rate of the IRTC and RTC functions.
NOTES
C/C++
Because _rtc is an intrinsic function, no externally visible library function is available for it. The compiler
generates inline code to produce the result.
Fortran
The names of these intrinsics cannot be passed as arguments.
When RTC is called as a subroutine, it accepts the following argument:
time The real-time clock value is returned as a REAL(KIND=8) value.
When IRTC is called as a subroutine, it accepts the following argument:
itime The real-time clock value is returned as an INTEGER(KIND=8) value.
The RTC intrinsic function is outmoded. For information on outmoded features and their preferred standard
alternatives, see the Fortran Language Reference Manual, Volume 3.
The use of RTC is not recommended on UNICOS or IRIX systems. See the standard SYSTEM_CLOCK(3I)
intrinsic subroutine for the preferred alternative.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
f90(1), SECOND(3F), SYSCLOCK(3F), SYSTEM_CLOCK(3I), TSECND(3F)
NAME
SCALE – Returns (x)(b**i), where b is the base in the real number model representation of x
SYNOPSIS
SCALE ([X=]x, [I=]i)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
i
The SCALE intrinsic function returns (x)(b ), where b is the base in the real number model representation of
x. For more information on the real number model, see the MODELS(3I) man page. It accepts the following
arguments:
x Must be of type real
i Must be of type integer
SCALE is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
This routine is implemented on Cray T90 systems that support IEEE arithmetic by calls to scalar– only
library routines.
RETURN VALUES
i
The result type and type parameter are the same as x. The result has the value (x)(b ), where b is defined in
the model for real numbers representing values of x, provided that this result is within range. Argument i
should be within the range of MINEXPONENT(x) ≤ i ≤ MAXEXPONENT(x). If i is outside this range, the
results are unpredictable.
EXAMPLES
SCALE(3.0,2) yields 12.0 for reals.
SEE ALSO
MODELS(3I)
NAME
SCAN – Scans a string for any one of the characters in a set of characters
SYNOPSIS
SCAN ([STRING=]string, [SET=]set [,[BACK=]back])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SCAN intrinsic function scans a string for any one of the characters in a set of characters. It accepts the
following arguments:
string Must be of type character.
set Must be of type character.
back Must be of type logical. If back is omitted, a value of false is assumed.
SCAN is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
SCAN returns the character position of the first character in string that matches any characters in set. The
result is a default integer.
If back is absent or present with value false and if string contains at least one character that is in set, the
value of the result is the position of the leftmost character of string that is in set.
If back is present with the value true, and if string contains at least one character that is in set, the value of
the result is the position of the rightmost character of string that is in set.
SCAN returns zero if no character in string is in set, or if the length of string is zero.
EXAMPLES
Example 1: The statement SCAN(’FORTRAN’,’TR’) yields 3.
Example 2: The statement SCAN(’FORTRAN’,’TR’,BACK=.TRUE.) yields 5.
NAME
SELECTED_INT_KIND – Returns an integer kind type parameter
SYNOPSIS
SELECTED_INT_KIND ([R=]r)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SELECTED_INT_KIND intrinsic function returns the kind type parameter of an integer data type that
r r
represents all integer values n with -10 < n < 10 . It accepts the following argument:
r Must be scalar and of type integer.
SELECTED_INT_KIND is a transformational function. The name of this intrinsic cannot be passed as an
argument.
RETURN VALUES
This intrinsic function returns the integer kind type parameter corresponding to the decimal exponent range
specified by its argument. The result is a default integer scalar. The result has a value equal to the value of
r
the kind type parameter of an integer data type that represents all values in the range of values – 10 < n <
r
10 , or if no such kind type parameter exists, the result is – 1. If more than one kind type parameter meets
the criteria, the value returned is the one with the smallest decimal exponent range, unless there are several
such values, in which case the smallest of these kind values is returned.
EXAMPLES
The SELECTED_INT_KIND intrinsic function generates the following results:
• SELECTED_INT_KIND(4) yields 2.
• SELECTED_INT_KIND(8) yields 4.
• SELECTED_INT_KIND(13) yields 8.
• SELECTED_INT_KIND(18) yields 8.
• SELECTED_INT_KIND(19) yields -1.
For information on the integer number model, see the MODELS(3I) man page.
SEE ALSO
MODELS(3I)
NAME
SELECTED_REAL_KIND – Returns the real kind type parameter
SYNOPSIS
SELECTED_REAL_KIND ([[P=]p] [,[R=]r])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SELECTED_REAL_KIND intrinsic function returns the real kind type parameter of a real data type with
decimal precision of at least p digits and a decimal exponent range of at least r. At least one argument must
be present, and the arguments are as follows:
p Must be scalar and of type integer.
r Must be scalar and of type integer.
SELECTED_REAL_KIND is a transformational function. The name of this intrinsic cannot be passed as an
argument.
RETURN VALUES
This intrinsic function returns the real kind type parameter corresponding to the decimal precision and
exponent range specified by its arguments. The result is a default integer scalar. The result has a value
equal to a value of the kind type parameter of a real data type with decimal precision, as returned by the
function PRECISION, of at least p digits and a decimal exponent range, as returned by the function RANGE,
of at least r, or if no such kind type parameter exists, the result is -1 if the precision is not available, -2 if
the exponent range is not available, and -3 if neither is available. If more than one kind type parameter
value meets the criteria, the value returned is the one with the smallest decimal precision, unless there are
several such values, in which case the smallest of these kind values is returned.
EXAMPLES
On UNICOS and UNICOS/mk systems, the following program is run:
PARAME TER (NP =9, NR= 9)
INTEGE R P(N P), R(N R), A(N R), B(N P)
DAT A P /-1,0, 1,6 ,7, 13, 14, 28, 29/
DAT A R /-1,0, 1,3 7,3 8,3 07, 308 ,24 65, 246 6/
WRITE (6,FMT =’( ’’ (P, R)| ’’, 10I 5)’ ) R
WRITE( 6,FMT= ’(" --- ------ --- --- --- --- --- --- --- --- --- --- --- --- -")’)
DO I=1 ,NP
DO J=1,NR
A(J )=SELE CTE D_R EAL _KI ND( P(I ),R (J) )
END DO
WRI TE (6, FMT =’( I6, ’’| ’’, 10I 5)’ ) P(I ),( A(K ),K =1, NR)
END DO
STOP
END
STOP
END
The following tables show the results obtained from the preceding programs.
Return values on IRIX systems:
(p) | (r=NULL)
--- --- --- -------
-1 | 4
0 | 4
1 | 4
6 | 4
7 | 8
15 | 8
16 | 16
33 | 16
34 | -1
SEE ALSO
MODELS(3I)
NAME
_semclr, _semget, _semput, _semset, _semts – Performs operations on the semaphore
SYNOPSIS
#include <intrinsics.h>
void _semclr (long n);
long _semget (void);
void _semput (long x);
void _semset (long n);
void _semts (long n);
IMPLEMENTATION
UNICOS systems
Cray C/C++
STANDARDS
C/C++ extension
DESCRIPTION
The _semclr function clears semaphore n.
The _semget function returns the value of the entire semaphore mask.
The _semput function stores the bit pattern in data word x into the semaphore mask (SM) register.
The _semset function sets semaphore n.
The _semts function performs a test-and-set operation on the semaphore n.
These functions accept the following variables:
x Data word.
n Value n must be a constant in the range 0 through 31.
NOTES
Because these are intrinsic functions, no externally visible library functions are available for them. The
compiler generates inline code to produce the result.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.
NAME
SET_EXPONENT – Sets exponent part of a number
SYNOPSIS
SET_EXPONENT ([X=]x, [I=]i)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SET_EXPONENT intrinsic function sets the exponent part of a number. It returns the numeric model
number whose fractional part is the fractional part of the real number model representation of x and whose
exponent part is i. For more information on the real number model, see the MODELS(3I) man page. It
accepts the following arguments:
x Must be of type real.
i Must be of type integer.
SET_EXPONENT is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
This routine is implemented on Cray T90 systems that support IEEE arithmetic by calls to scalar– only
library routines.
RETURN VALUES
i-e
The result type and type parameter are the same as x. The result has the value (x)(b ), where b and e are
defined in the model, provided that this result is within range. Argument i should be within the range of
MINEXPONENT(x) ≤ i ≤ MAXEXPONENT(x). If i is outside this range, the results are unpredictable. If x
has value 0, the result has value 0.
EXAMPLES
SET_EXPONENT(3.0,1) yields 1.5.
SEE ALSO
MODELS(3I)
Fortran Language Reference Manual, Volume 2
NAME
SET_IEEE_EXCEPTION – Sets floating-point exception indicator
SYNOPSIS
SET_IEEE_EXCEPTION ([EXCEPTION=]exception)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The SET_IEEE_EXCEPTION intrinsic subroutine sets the specified floating-point exception indicator. It
accepts the following argument:
exception Must be of an integer type that occupies a full word. It is an INTENT(IN) argument. If
exception is an array, it must be 1-dimensional. The single argument in the scalar case, or
each array element in the array case, must be set to one of the values represented by the
following named constants:
• IEEE_XPTN_CRI_INVALID_OPND (valid on Cray T90 systems only)
• IEEE_XPTN_INEXACT_RESULT
• IEEE_XPTN_UNDERFLOW
• IEEE_XPTN_OVERFLOW
• IEEE_XPTN_DIV_BY_ZERO
• IEEE_XPTN_INVALID_OPR
• IEEE_XPTN_ALL (all exceptions in this list)
The exception indicator specified by exception (or each element of exception) is set so it indicates that the
exception has occurred.
Using this subroutine to set an exception indicator does not cause the exception to be raised.
SET_IEEE_EXCEPTION is an elemental subroutine. The name of this intrinsic cannot be passed as an
argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN _IEEE_ DEF INI TIO NS
EXAMPLES
The following example sets the divide by zero exception indicator so that the next time
TEST_IEEE_EXCEPTION tests the indicator, it will indicate the exception has occurred:
CALL SET_IE EE_ EXC EPT ION (IE EE_ XPT N_D IV_ BY_ ZER O)
SEE ALSO
CLEAR_IEEE_EXCEPTION(3I), GET_IEEE_EXCEPTIONS(3I), TEST_IEEE_EXCEPTION(3I)
NAME
SET_IEEE_EXCEPTIONS – Restores the caller’s floating-point status prior to exiting a procedure
SYNOPSIS
SET_IEEE_EXCEPTIONS ([STATUS=]status)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The SET_IEEE_EXCEPTIONS intrinsic subroutine restores the caller’s floating-point status just before
exiting a procedure. It accepts the following argument:
status Must be scalar and of an integer type that occupies a full word. It is an INTENT(IN)
argument.
On Cray T90 systems that support IEEE floating-point arithmetic, the bits in status that represent exception
flags are stored into the appropriate bits of SR0. On other architectures, the flags are stored into the
appropriate flag bits of memory word(s)/register(s) that record the floating-point state.
The value of status is assumed to have been set by GET_IEEE_STATUS(3I).
The name of this intrinsic cannot be passed as an argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN_IE EE_DEF INI TIO NS
EXAMPLES
See the example on CLEAR_IEEE_EXCEPTION(3I).
SEE ALSO
CLEAR_IEEE_EXCEPTION(3I), GET_IEEE_STATUS(3I)
NAME
SET_IEEE_INTERRUPTS – Restores floating-point interrupt status before exiting a procedure
SYNOPSIS
SET_IEEE_INTERRUPTS ([STATUS=]status)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The SET_IEEE_INTERRUPTS intrinsic subroutine is typically used to restore the caller’s floating-point
interrupt status just before exiting a procedure. It accepts the following argument:
status Must be scalar and of an integer type that occupies a full word. It is an INTENT(IN)
argument.
On Cray T90 systems, the bits in status that represent interrupt flags are stored into the appropriate bits of
SR0. On other architectures, the flags are stored into the appropriate flag bits of memory word(s)/register(s)
that record the floating-point interrupt state.
The contents of status are assumed to have been set by an invocation of GET_IEEE_INTERRUPTS(3I).
The name of this intrinsic cannot be passed as an argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN _IEEE_ DEF INI TIO NS
EXAMPLES
See the example on DISABLE_IEEE_INTERRUPT(3I).
SEE ALSO
DISABLE_IEEE_INTERRUPT(3I), GET_IEEE_INTERRUPTS(3I)
NAME
SET_IEEE_ROUNDING_MODE – Alters current floating-point rounding mode state and restores the
floating-point rounding mode before exiting a procedure
SYNOPSIS
SET_IEEE_ROUNDING_MODE ([ROUNDING_MODE=]rounding_mode)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The SET_IEEE_ROUNDING_MODE intrinsic subroutine is typically used to alter the current floating-point
rounding mode state and to restore the caller’s floating-point rounding mode just before exiting a procedure.
It accepts the following argument:
rounding_mode
Must be scalar and of an integer type that occupies a full word. It is an INTENT(IN)
argument.
The floating-point rounding mode is set to the rounding mode indicated by rounding_mode.
rounding_mode must have one of the values represented by the following named constants:
• IEEE_RM_NEAREST
• IEEE_RM_POS_INFINITY
• IEEE_RM_ZERO
• IEEE_RM_NEG_INFINITY
rounding_mode is assumed to have been set through an invocation of
GET_IEEE_ROUNDING_MODE(3I).
The IEEE_REAL(3I) and IEEE_INT(3I) functions are the only routines supplied by Silicon Graphics that
examine the setting of the rounding mode on Cray T90 systems that support IEEE arithmetic, UNICOS/mk
systems, and IRIX systems.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN _IE EE_ DEFINITIO NS
EXAMPLES
! Ass ume the follow ing cod e is exe cut ing on a mac hin e whe re def ault
! int ege r occupies a ful l wor d.
! Sav e the cur rent rou nding mod e the n cha nge the rou nding mode
! to rou nd to pos itive inf ini ty.
CAL L GET _IE EE_ ROUNDING_ MOD E(s ave_ro und ing _mode)
CAL L SET _IE EE_ROUNDI NG_ MOD E(IEEE _RM _PO S_I NFINIT Y)
DO i = 1, n
xup (i) = y(i ) + z(i )
END DO
CAL L SET _IE EE_ROUNDI NG_ MOD E(IEEE _RM _NE G_I NFINIT Y)
DO i = 1, n
xdn (i) = y(i ) + z(i )
END DO
! Res tor e ori ginal rou ndi ng mode and ret urn to the cal ler.
CAL L SET _IE EE_ROU NDI NG_ MODE(s ave _ro und ing_mo de)
SEE ALSO
GET_IEEE_ROUNDING_MODE(3I)
NAME
SET_IEEE_STATUS – Restores floating-point status
SYNOPSIS
SET_IEEE_STATUS ([STATUS=]status)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The SET_IEEE_STATUS intrinsic subroutine is typically used to restore the caller’s floating-point status
just before exiting a procedure. It accepts the following argument:
status Must be scalar and of an integer type that occupies a full word. It is an INTENT(IN)
argument.
On Cray T90 systems that support IEEE floating-point arithemetic, its value (contained in a
64-bit word) is stored into SR0. On other architectures, the flags are stored into the appropriate
flag bits of the word(s) or register(s) that record the floating-point state.
The value in status is assumed to have been produced through an invocation of
GET_IEEE_STATUS(3I).
The name of this intrinsic cannot be passed as an argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN _IEEE_ DEF INI TIO NS
There are 6 bits, called the IEEE Floating Point Exception Status Bits or the sticky bits, that indicate whether
any one of 6 possible exceptions has occurred (the 5 exceptions specified by the IEEE floating-point standard
and a Silicon Graphics extension). The user program begins with these bits cleared to zero. The occurrence
of any of the exceptions will set the corresponding bit. Only the user can clear these bits.
EXAMPLES
! Assume this exa mpl e dem ons tra tes cod e for an IRI X sys tem
! where defaul t int ege r typ e occ upi es a ful l wor d.
GET_IEEE_STATUS(3I) is called upon entry to the example’s procedure CALCULATE to capture the
current floating-point status. If procedure CALCULATE changes the floating-point status, the original
floating-point status can be reset before exiting from CALCULATE by calling SET_IEEE_STATUS.
SEE ALSO
GET_IEEE_STATUS(3I)
NAME
SHAPE – Returns the shape of an array or a scalar
SYNOPSIS
SHAPE ([SOURCE=]source)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SHAPE intrinsic function returns the shape of an array or a scalar. It accepts the following argument:
source May be of any type. It can be array valued or scalar. It must not be a pointer that is
disassociated or an allocatable array that is not allocated. It must not be an assumed-size array.
SHAPE is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a default integer array of rank 1 whose size is equal to the rank of source. The value of the
result is the shape of source.
EXAMPLES
SHAPE(A(2:5,-1:1)) yields (/4,3/).
SHAPE(3) yields a zero-sized, rank-one array.
NAME
SHIFT – Performs a left circular shift
SYNOPSIS
SHIFT ([I=]i,[J=]j)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
SHIFT performs a left circular shift of i by j bits. It accepts the following arguments:
i The value to be shifted. i can be of type Boolean, integer, real, or Cray pointer.
j The number of bits to shift the value. Must be of type integer or Boolean. j must be within the
range 0 ≤ j ≤size, where size is the size, in bits, of i. That is, if i is a 64-bit object, j must be
within the range 0 ≤ j ≤ 64.
For values of j outside these ranges, SHIFT returns an undefined result.
On UNICOS systems, an object is 64 bits. On UNICOS/mk systems, an object is 32 bits or 64 bits. On
IRIX systems, an object is 8 bits, 16 bits, 32 bits, or 64 bits.
SHIFT is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
This is an outmoded routine. Refer to the Fortran Language Reference Manual, Volume 2, for information
about outmoded features and their preferred standard alternatives.
The bit representation of the logical data type is not consistent among UNICOS and UNICOS/mk systems.
For further details, see your compiler’s reference manuals.
RETURN VALUES
SHIFT returns a value of type Boolean on UNICOS and UNICOS/mk systems. It returns an integer result
on IRIX systems.
EXAMPLES
The following section of Fortran code shows the SHIFT function used in the case where i is of type integer.
For simplicity, a 16-bit object is used. The bit pattern of i and the bit pattern of the result are also given.
INT EGER I1, I2, I3
...
I2 = 5
I3 = SHIFT( I1, I2)
------ --- --- --- ------ --- --- --- --- --- --- --- --- --- --- --- --- ------
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
------ --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
I1 (i)
------ --- --- --- ------ --- --- --- --- --- --- --- --- --- --- --- --- ------
| 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 |
------ --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
I3 (re sul t)
SEE ALSO
SHIFTL(3I)
NAME
SHIFTA – Performs an arithmetic shift
SYNOPSIS
SHIFTA ([I=]i, [J=]j)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
The SHIFTA intrinsic function performs a right shift with sign extension fill of the object i by j. Its
arguments are as follows:
i The value to be shifted. Must be of type Boolean, integer, real, or Cray pointer.
j The number of bits to shift the value. Must be of type integer or Boolean. j must be within the
range 0 ≤ j ≤ size, where size is the size, in bits, of i. That is, if i is a 64-bit object, j must be
within the range 0 ≤ j ≤ 64.
For values of j outside these ranges, SHIFTA returns an undefined result.
On UNICOS systems, an object is 64 bits. On UNICOS/mk systems, an object is 32 bits or 64 bits. On
IRIX systems, an object is 8 bits, 16 bits, 32 bits, or 64 bits.
SHIFTA is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
The bit representation of the logical data type is not consistent among UNICOS and UNICOS/mk systems.
For further details, see the Fortran Language Reference Manual, Volume 3.
RETURN VALUES
SHIFTA returns a value of type Boolean on UNICOS and UNICOS/mk systems. It returns an integer result
on IRIX systems.
EXAMPLES
The following section of Fortran code shows the SHIFTA function used in the case where i is of type
integer. The bit pattern of i and the bit pattern of the result are shown. For clarity, a 16-bit value is used
rather than a 64-bit value.
INT EGER I1, I2, I3
...
I2 = 5
I3 = SHIFTA (I1 ,I2 )
---------------------------------------------------------------
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
---------------------------------------------------------------
I1 (i)
---------------------------------------------------------------
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |
---------------------------------------------------------------
I3 (result)
NAME
SHIFTL – Performs a left shift with zero fill
SYNOPSIS
SHIFTL ([I=]i,[J=]j)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
The SHIFTL intrinsic function performs a left shift with zero fill of i by j bits. It accepts the following
arguments:
i The value to be shifted. i can be of type Boolean, integer, real, or Cray pointer.
j The number of bits to shift the value. Must be of type integer or Boolean. j must be within the
range 0 ≤ j ≤size, where size is the size, in bits, of i. That is, if i is a 64-bit object, j must be
within the range 0 ≤ j ≤ 64.
On UNICOS systems, an object is 64 bits. On UNICOS/mk systems, an object is 32 bits or 64 bits. On
IRIX systems, an object is 8 bits, 16 bits, 32 bits, or 64 bits.
SHIFTL is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
This is an outmoded routine. Refer to the Fortran Language Reference Manual, Volume 2, for information
about outmoded features and their preferred standard alternatives.
The bit representation of the logical data type is not consistent among UNICOS and UNICOS/mk systems.
For further details, see your compiler’s reference manuals.
RETURN VALUES
SHIFTL returns a value of type Boolean on UNICOS and UNICOS/mk systems. It returns an integer result
on IRIX systems.
EXAMPLES
The following section of Fortran code shows the SHIFTL function used in the case where i is of type
integer. The bit pattern of i and the bit pattern of the result are also given. For simplicity, a 16-bit object is
used.
INT EGER I1, I2, I3
...
I2 = 5
I3 = SHIFTL (I1 ,I2 )
------ --- --- --- ------ --- --- --- --- --- --- --- --- --- --- --- --- ------
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
------ --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
I1 (i)
------ --- --- --- ------ --- --- --- --- --- --- --- --- --- --- --- --- ------
| 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
------ --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
I3 (re sul t)
NAME
SHIFTR – Performs a right shift with zero fill
SYNOPSIS
SHIFTR ([I=]i,[J=]j)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
The SHIFTR intrinsic function performs a right shift with zero fill of the i by j bits. It accepts the following
arguments:
i The value to be shifted. i can be of type Boolean, integer, real, or Cray pointer.
j The number of bits to shift the value. Must be of type integer or Boolean. j must be within the
range 0 ≤ j ≤size, where size is the size, in bits, of i. That is, if i is a 64-bit object, j must be
within the range 0 ≤ j ≤ 64.
On UNICOS systems, an object is 64 bits. On UNICOS/mk systems, an object is 32 bits or 64 bits. On
IRIX systems, an object is 8 bits, 16 bits, 32 bits, or 64 bits.
SHIFTR is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
This is an outmoded routine. Refer to the Fortran Language Reference Manual, Volume 2, for information
about outmoded features and their preferred standard alternatives.
The bit representation of the logical data type is not consistent among UNICOS and UNICOS/mk systems.
For further details, see your compiler’s reference manuals.
RETURN VALUES
SHIFTR returns a value of type Boolean on UNICOS and UNICOS/mk systems. It returns an integer result
on IRIX systems.
EXAMPLES
The following section of Fortran code shows the SHIFTR function used in the case where i is of type
integer. The bit pattern of i and the bit pattern of the result are also given. For simplicity, a 16-bit object is
used.
INT EGER I1, I2, I3
...
I2 = 5
I3 = SHIFTR (I1 ,I2 )
------ --- --- --- ------ --- --- --- --- --- --- --- --- --- --- --- --- ------
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
------ --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
I1 (i)
------ --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |
------ --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
I3 (re sul t)
NAME
SHORT – Returns integer (KIND=2) result
SYNOPSIS
SHORT ([A=]a)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
SHORT returns an integer (KIND=2) result for a given argument. This intrinsic accepts the following
argument:
a Must be of type integer, real, or complex.
This is an elemental function. The name of this intrinsic cannot be passed an an argument.
RETURN VALUES
The return value is an integer (KIND=2).
SEE ALSO
LONG(3I)
NAME
SIGN, DSIGN, QSIGN, ISIGN, IISIGN, JISIGN, KISIGN – Transfers the sign of numbers
SYNOPSIS
SIGN ([A=]a,[B=]b)
DSIGN ([A=]a,[B=]b)
QSIGN ([A=]a,[B=]b)
ISIGN ([A=]a,[B=]b)
IISIGN ([A=]a,[B=]b)
JISIGN ([A=]a,[B=]b)
KISIGN ([A=]a,[B=]b)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: ISIGN, IISIGN, JISIGN, KISIGN, DSIGN, QSIGN
DESCRIPTION
These intrinsics transfer the sign of b to a. SIGN is the generic function name; the others are specifics.
These are elemental intrinsic functions. They accept the following arguments:
a Must be of type integer or real. If a is zero, the result is zero for SIGN, ISIGN, DSIGN, and
QSIGN.
b Must be of the same type and kind type as a.
These functions evaluate one of the following equations, depending on the sign of the number:
y = a , if b ≥ 0
or
y = – a , if b < 0
SIGN transfers the sign from one real number to another.
ISIGN transfers the sign from one integer (KIND=2 or KIND=4) to another.
IISIGN transfers the sign from one integer (KIND=2) to another.
EXAMPLES
The SIGN intrinsic function yields differing values depending on your platform, as follows:
• On UNICOS/mk and UNICOS systems that support IEEE floating-point arithmetic, SIGN(-1.0,-.0)
yields -1.0.
• On UNICOS systems that do not support IEEE floating-point arithmetic, SIGN(-1.0,-.0) yields 1.0.
• On IRIX systems, SIGN(-1.0,-.0) yields 1.0.
• On IRIX systems, if the program is compiled with the -LANG:IEEE_minus_zero=ON option,
SIGN(-1.0,-.0) yields -1.0.
NAME
SIN, DSIN, QSIN, CSIN, CDSIN, CQSIN, SIND, DSIND, QSIND – Computes sine
SYNOPSIS
SIN ([X=]x)
DSIN ([X=]x)
QSIN ([X=]x)
CSIN ([X=]x)
CDSIN ([X=]x)
CQSIN ([X=]x)
SIND ([X=]x)
DSIND ([X=]x)
QSIND ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QSIN, CDSIN, CQSIN, SIND, DSIND, QSIND
DESCRIPTION
These functions evaluate y = sin(x).
SIN and SIND are the generic function names; the others are specifics. These are elemental intrinsic
functions. They accept the following argument:
x Must be of type real or complex. For SIN, DSIN, QSIN, CSIN, CDSIN, and CQSIN, x must
be specified in radians and is treated as modulo 2 * pi. For SIND, DSIND, and QSIND, x must
be specified in degrees and is treated as modulo 360.
Vector versions of these intrinsics exist on some systems. Vector versions of the SIN, DSIN, CSIN, and
CDSIN intrinsics exist on UNICOS and UNICOS/mk systems. On UNICOS/mk systems, the vector versions
of these intrinsics are used when -O vector3 or -O3 are specified on the compiler command line. A
vector version of the single-precision and double-precision SIN intrinsic exists on IRIX systems and is used
when -O3 is specified on the compiler command line.
NOTES
The SIN, DSIN, and CSIN intrinsic function names can be passed as arguments; the others cannot.
Return values differ, depending on your platform, as follows:
• On UNICOS and UNICOS/mk systems that support the IEEE standard for floating-point arithmetic,
25
SIN(x) yields NaN if x > 2 .
• On UNICOS systems that do not support the IEEE standard for floating-point arithmetic, SIN(x) yields
25
0 if x > 2 .
• On IRIX systems, SIN(x) yields NaN if x > 2 19 .
On all systems that support the IEEE standard for floating-point arithmetic, SIN(NaN) yields NaN.
RETURN VALUES
SIN returns the real sine of its real arguments.
DSIN returns the double-precision real sine of its double-precision real argument.
QSIN return the quad-precision real sine of its quad-precision real argument.
CSIN returns the complex sine of its complex argument.
CDSIN returns the double-precision complex sine of its double-precision complex argument.
CQSIN returns the quad-precision complex sine of its quad-precision complex argument.
SIND returns the single-precision real sine of its single-precision real argument.
DSIND returns the double-precision real sine of its double-precision real argument.
QSIND returns the quad-precision real sine of its quad-precision real argument.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
NAME
SINH, DSINH, QSINH – Computes hyperbolic sine
SYNOPSIS
SINH ([X=]x)
DSINH ([X=]x)
QSINH ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QSINH
DESCRIPTION
These are elemental intrinsic functions. SINH is the generic function name. These functions accept the
following argument:
x Must be of type real. See the RETURN VALUES section for information on input data types
and return values.
x –x
These functions evaluate y = sinh(x) = (e – e ) / 2.
NOTES
The names of these intrinsics can be passed as arguments.
RETURN VALUES
SINH returns the real hyperbolic sine of its real argument.
DSINH returns the double-precision real hyperbolic sine of its double-precision real argument.
QSINH returns the quad-precision real hyperbolic sine of its quad-precision real argument.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
EXAMPLES
On Cray T90 systems that support IEEE arithmetic, the following return values occur:
• If x > 709.78, SINH(x) yields infinity.
• If x < -709.78, SINH(x) yields -infinity.
• SINH(NaN) yields NaN.
NAME
SIZE – Returns the total number of elements in an array
SYNOPSIS
SIZE ([ARRAY=]array [,[DIM=]dim])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SIZE intrinsic function returns the extent of an array along a specified dimension or the total number of
elements in the array. It accepts the following arguments:
array May be of any type. It must not be scalar. It must not be a pointer that is disassociated or an
allocatable array that is not allocated. If array is an assumed-size array, dim must be present
with a value less than the rank of array.
dim Must be scalar and of type integer with a value in the range 1 ≤ dim ≤ n, where n is the rank of
array.
SIZE is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a default integer scalar. The result has a value equal to the extent of dimension dim of array
or, if dim is absent, the total number of elements of array.
EXAMPLES
SIZE(A(2:5,-1:1),DIM=2) yields 3.
SIZE(A(2:5,-1:1)) yields 12.
NAME
SIZEOF – Returns bytes of storage
SYNOPSIS
SIZEOF ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran extension
DESCRIPTION
The SIZEOF inquiry function returns the number of bytes of storage used by x. This function accepts the
following argument:
x A scalar or array of type character, complex, integer, logical, or real. Cannot be an assumed-size
array.
The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type and type parameter are of type default integer.
NAME
SPACING – Returns the absolute spacing of real model numbers near the argument value
SYNOPSIS
SPACING ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SPACING intrinsic function returns the absolute spacing of real model numbers near the argument
value. It accepts the following argument:
x Must be of type real
SPACING is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
This routine is implemented on Cray T90 systems that support IEEE arithmetic by calls to scalar– only
library routines.
RETURN VALUES
e– p
The result type and type parameter are the same as x. The result has the value b , where b, e, and p are as
defined in the real number model, provided this result is within range. If not, the result is the same as that
of TINY (x). For more information on the real number model, see the MODELS(3I) man page.
EXAMPLES
Example 1: Cray C90 systems yield the following values:
• SPACING(3.0) yields 2.8421709430404E-14.
• SPACING(3.0_4) yields 2.384185791015625E-7.
• SPACING(3.0_8) yields 2.8421709430404E-14.
• SPACING(3.0_16) yields 1.009741958682895E-28.
The first is default type real, and the others are defined.
Example 2: IRIX systems yield the following values:
• SPACING(3.0) yields 2.384185791E-7.
• SPACING(3.0_4) yields 2.384185791E-7.
• SPACING(3.0_8) yields 4.44089209850062616E-16.
• SPACING(3.0_16) yields 2.46519032881566189191165176650870697E-32.
The first is default type real, and the others are defined.
Example 3: UNICOS/mk systems yield the following values:
• SPACING(3.0) yields 4.44089209850062616E-16.
• SPACING(3.0_4) yields 2.384185791015625E-7.
• SPACING(3.0_8) yields 4.44089209850062616E-16.
• SPACING(3.0_16) yields 4.44089209850062616E-16.
Example 4: Cray T90 systems that support IEEE floating-point yield the following values:
• SPACING(3.0) yields 4.44089209850062616E-16.
• SPACING(3.0_4) yields 4.44089209850062616E-16.
• SPACING(3.0_8) yields 4.44089209850062616E-16.
• SPACING(3.0_16) yields 3.85185988877447171E-34.
Note that there is no KIND=4 value and that default is KIND=8.
SEE ALSO
MODELS(3I)
NAME
SPREAD – Constructs an array from several copies of an argument
SYNOPSIS
SPREAD ([SOURCE=]source, [DIM=]dim, [NCOPIES=]ncopies)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SPREAD intrinsic function constructs an array from several copies of an argument. This intrinsic
function can be used for array construction. It replicates an array by adding a dimension. It broadcasts
several copies of source along a specified dimension and thus forms an array of rank one greater. SPREAD
accepts the following arguments:
source May be of any type. It may be scalar or array valued. The rank of source must be less than 7.
dim Must be scalar and an integer with value in the range of 1 ≤ dim ≤ n + 1, where n is the rank of
source.
ncopies Must be scalar and an integer.
SPREAD is a transformational intrinsic function. The name of this intrinsic cannot be passed as an
argument.
RETURN VALUES
The result is an array of the same type as source and of rank n+1, where n is the rank of source.
If source is scalar, the shape of the result is MAX(ncopies,0). If source is array valued with shape
(d 1 , d 2 , . . ., d n ), the shape of the result is (d 1 , d 2 , . . ., d dim– 1 , MAX(ncopies, 0), d dim , . . ., d n ).
If source is scalar, each element of the result has a value equal to source.
If source is array valued, the element of the result with subscripts (r 1 , r 2 , . . ., r n+1 ) has the value
source(r 1 , r 2 , . . ., r dim– 1 , r dim+1 , . . ., r n+1 )).
EXAMPLES
Example 1: Assume that ISCALR is the scalar value of 8. The following statements are then true:
• SPREAD(ISCALR,DIM=1,NCOPIES=0) yields a zero-sized array.
• SPREAD(ISCALR,DIM=1,NCOPIES=2) yields (/8,8/).
Example 2: Assume that A is the array [2,3,4]. The following statements are then true:
• SPREAD(A,DIM=1,NCOPIES=0) yields a zero-sized array.
• SPREAD(A,DIM=1,NCOPIES=3) yields:
234
234
234
• SPREAD(A,DIM=2,NCOPIES=3) yields:
222
333
444
NAME
SQRT, DSQRT, QSQRT, CSQRT, CDSQRT, CQSQRT – Computes square root
SYNOPSIS
SQRT ([X=]x)
DSQRT ([X=]x)
QSQRT ([X=]x)
CSQRT ([X=]x)
CDSQRT ([X=]x)
CQSQRT ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extensions: QSQRT, CDSQRT, CQSQRT
DESCRIPTION
The SQRT, DSQRT, QSQRT, CSQRT, CDSQRT, and CQSQRT intrinsic functions compute the square root of
their arguments.
1/2
These functions evaluate y = x .
SQRT is the generic function name; the others are specifics. These are elemental intrinsic functions. They
accept the following argument:
x Must be of type real or complex. If i is of type real, it must be greater than or equal to zero.
Vector versions of these intrinsics exist on some systems. Vector versions of the SQRT, DSQRT, CSQRT,
and CDSQRT intrinsics exist on UNICOS and UNICOS/mk systems. On UNICOS/mk systems, the vector
versions of these intrinsics are used when -O vector3 or -O3 are specified on the compiler command
line. A vector version of the single-precision and double-precision SQRT intrinsic exists on IRIX systems
and is used when -O3 is specified on the compiler command line.
NOTES
The SQRT, DSQRT, and CSQRT intrinsic function names can be passed as arguments; the others cannot.
On Cray T90 systems that support IEEE arithmetic, the following return values occur:
• SQRT(0) yields 0.
• SQRT(-0) yields -0.
NAME
SUM – Sums array elements
SYNOPSIS
SUM ([ARRAY=]array [,[DIM=]dim] [,[MASK=]mask])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SUM intrinsic function sums all the elements of array along dimension dim that correspond to the true
elements of mask. It accepts the following arguments:
array Must be of type integer, real, or complex. It must not be scalar.
dim Must be scalar and of type integer with a value in the range 1 ≤ dim ≤ n, where n is the rank of
array. The corresponding actual argument must not be an optional dummy argument.
mask Must be of type logical and must be conformable with array.
SUM is a transformational intrinsic function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is of the same type and kind type parameter as array. It is scalar if dim is absent or if array has
rank one; otherwise, the result is an array of rank n– 1 and of shape (d 1 , d 2 , . . ., d dim– 1 , d dim+1 , . . ., d n ),
where (d 1 , d 2 , . . ., d n ) is the shape of array.
The result of SUM(array) has a value equal to the sum of all the elements of array. If array has size 0, it
has the value 0.
The result of SUM(array,MASK=mask) has a value equal to the sum of the elements of array corresponding
to the true elements of mask. It has the value 0 if there are no true elements.
If array has rank one, SUM(array,dim[,mask]) has a value equal to that of SUM(array[,MASK=mask]).
Otherwise, the value of element (s 1 , s 2 , . . ., s dim– 1 , s dim+1 , . . ., s n ) of SUM(array,dim[,mask]) is equal to
SUM(array(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n ) [, MASK=mask(s 1 , s 2 , . . ., s dim– 1 , : , s dim+1 , . . ., s n )]).
EXAMPLES
Example 1: SUM((/1,2,3/)) yields 6.
Example 2: SUM(C,MASK=C.GT.0.0) yields the arithmetic sum of the positive elements of C.
Example 3: Assume that B is the following array:
135
246
In this case, the following are true:
• SUM(B,DIM=1) yields (/3,7,11/).
• SUM(B,DIM=2) yields (/9,12/).
NAME
LOCK_RELEASE, SYNCHRONIZE, AND_AND_FETCH, ADD_AND_FETCH, COMPARE_AND_SWAP,
FETCH_AND_ADD, FETCH_AND_AND, FETCH_AND_NAND, FETCH_AND_OR, FETCH_AND_SUB,
FETCH_AND_XOR, LOCK_TEST_AND_SET, NAND_AND_FETCH, OR_AND_FETCH, SUB_AND_FETCH,
XOR_AND_FETCH, – Fortran synchronization intrinsics for multiprocessing
SYNOPSIS
CALL LOCK_RELEASE ([I=]i)
CALL SYNCHRONIZE
ADD_AND_FETCH ([I=]i, [J=]j)
AND_AND_FETCH ([I=]i, [J=]j)
COMPARE_AND_SWAP ([I=]i, [J=]j, [K=]k)
FETCH_AND_ADD ([I=]i, [J=]j)
FETCH_AND_AND ([I=]i, [J=]j)
FETCH_AND_NAND ([I=]i, [J=]j)
FETCH_AND_OR ([I=]i, [J=]j)
FETCH_AND_SUB ([I=]i, [J=]j)
FETCH_AND_XOR ([I=]i, [J=]j)
LOCK_TEST_AND_SET ([I=]i, [J=]j)
NAND_AND_FETCH ([I=]i, [J=]j)
OR_AND_FETCH ([I=]i, [J=]j)
SUB_AND_FETCH ([I=]i, [J=]j)
XOR_AND_FETCH ([I=i, [J=]j)
IMPLEMENTATION
IRIX systems
MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
The synchronization intrinsics provide a variety of synchronization operations. LOCK_RELEASE and
SYNCHRONIZE are intrinsic subroutines; all the others are elemental intrinsic functions. These intrinsics
accept the following arguments:
i An integer. i must be KIND=4 or KIND=8.
j An integer. j must be the same kind type as i.
k An integer. k must be the same kind type as i and j.
The memory barrier intrinsics perform either an acquire barrier, release barrier, or full barrier operation. The
operation type and the intrinsics that accomplish that type of task are as follows:
Type Description
Acquire barrier Prevents the movement of memory references to visible data from after the intrinsic
(in program order) to before the intrinsic. This behavior is desirable for lock-acquire
operations.
Acquire barrier operations can be accomplished by using the
LOCK_TEST_AND_SET intrinsic subroutine. This subroutine atomically stores the
value of the second argument into the first argument. It returns the old value of the
first argument.
Release barrier Prevents the movement of memory references to visible data from before the
intrinsic (in program order) to after the intrinsic. This behavior is desirable for
lock-release operations.
Release barrier operations can be accomplished by using the LOCK_RELEASE
intrinsic subroutine. This subroutine sets its argument to zero.
Full barrier Prevents the movement of memory references to visible data past the intrinsic in
either direction. These act as both an acquire and a release barrier. A barrier only
restricts the movement of memory references to visible data across the intrinsic
operation. Between synchronization operations (or in their absence), memory
references to visible data can be freely reordered, subject to the usual
data-dependence constraints.
Full barrier operations are divided into the following groups:
• Atomic FETCH_AND_op operations. The FETCH_AND_ADD,
FETCH_AND_AND, FETCH_AND_NAND, FETCH_AND_OR, FETCH_AND_SUB,
and FETCH_AND_XOR intrinsic functions perform the operation with the second
argument on the first argument. They return the old value of the first argument.
• Atomic op_AND_FETCH operations. The ADD_AND_FETCH,
AND_AND_FETCH, NAND_AND_FETCH, OR_AND_FETCH, SUB_AND_FETCH,
and XOR_AND_FETCH intrinsic functions perform the operation with the second
argument on the first argument. They return the new value of the second
argument.
• Atomic COMPARE_AND_SWAP operation. The COMPARE_AND_SWAP intrinsic
function compares the value of the first argument to the value of the second. If
they are equal, the value of the third argument is stored into the first and the
return value is TRUE. Otherwise, the return value is FALSE.
• Atomic SYNCHRONIZE operation. This is performed with the SYNCHRONIZE
intrinsic subroutine.
RETURN VALUES
The COMPARE_AND_SWAP intrinsic function returns TRUE or FALSE. All other intrinsic functions return
a value of type integer. The integer values returned are of the same kind type as the arguments provided.
NOTES
Each intrinsic possesses two key properties:
• The operation performed is guaranteed to be atomic. This is typically achieved by implementing the
operation using a sequence of load-linked/store-conditional instructions in a loop.
• Associated with each intrinsic are certain memory barrier properties that restrict the movement of memory
references to visible data across the intrinsic operation (by either the compiler or the processor).
A visible memory reference is a reference to a data object potentially accessible by another thread executing
in the same shared address space. A visible data object can be one of the following:
• C/C++ global data
• Fortran COMMON data
• VOLATILE data
• Static data (either file-scope or function-scope)
• Data accessible through function parameters
• AUTOMATIC data (local-scope) that has had its address taken and assigned to some object that is visible
(recursively).
CAUTIONS
Conditional execution of a synchronization intrinsic, such as within an IF or WHILE block, does not prevent
the movement of memory references to visible data past the overall IF or WHILE construct.
NAME
SYNC_IMAGES – Synchronizes images
SYNOPSIS
SYNC_IMAGES([[IMAGE=]image])
IMPLEMENTATION
UNICOS/mk systems
CF90
STANDARDS
Fortran extension
DESCRIPTION
SYNC_IMAGES is an intrinsic procedure that synchronizes images. It is an intrinsic subroutine.
SYNC_IMAGES accepts the following argument:
image A scalar integer or an integer array. The behavior of SYNC_IMAGES differs, as follows,
depending on whether image is specified and whether it is a scalar or an array:
• If image is absent, the image waits for all other images to call SYNC_IMAGES with no
argument.
• If image is a scalar and the invoking image has index i, the invoking image waits for the
image with index image to execute a SYNC_IMAGES call with a scalar argument with value
i. After both calls are made, execution proceeds. If image is i, the call has no effect. If
image has a value that is less than 1 or greater than NUM_IMAGES(3I), the behavior is
undefined.
• If image is an array, the invoking image has index i and array image contains the value i, the
invoking image waits for those images whose values are contained in array image to execute
a SYNC_IMAGES call with an array argument that contains the value i. Any values in array
images that are outside the range 1 through NUM_IMAGES are ignored. If image does not
contain the value i, the behavior is undefined.
SEE ALSO
CF90 Co-array Programming Manual
NAME
SYSTEM_CLOCK – Returns integer data from a real-time clock
SYNOPSIS
CALL SYSTEM_CLOCK ([[COUNT=]count] [,[COUNT_RATE=]count_rate]
[,[COUNT_MAX=count_max])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The SYSTEM_CLOCK intrinsic subroutine returns information gathered from the real-time clock.
SYSTEM_CLOCK accepts the following arguments:
count Must be type default integer. If count is present, it is set to a machine-specific value based on
the current value of the machine’s clock. If there is no clock, it is set to – HUGE(0). The
machine-specific value is incremented by one for each clock count until the value count_max is
reached; it is reset to 0 at the next count. If there is a clock, it lies in the range 0 to count_max.
count_rate Must be type default integer. If count_rate is present, it is set to the number of clock counts per
second. If there is no clock, it is set to 0.
count_max Must be type default integer. If count_max is present, it is set to the maximum value that count
can have. If there is no clock, it is set to 0.
The arguments to SYSTEM_CLOCK cannot be declared with a nondefault kind type.
The name of this intrinsic cannot be passed as an argument.
Hardware counter values from the syssgi(2) system call are used on IRIX systems. The real-time clock is
used on UNICOS and UNICOS/mk systems.
Due to the hardware characteristics of UNICOS systems, the values returned in count and count_max are
64-bit values on these systems.
SEE ALSO
SYSCLOCK(3F)
gettimeofday(2) in the UNICOS System Calls Reference Manual
NAME
TAN, DTAN, QTAN, TAND, DTAND, QTAND – Computes tangent
SYNOPSIS
TAN ([X=]x)
DTAN ([X=]x)
QTAN ([X=]x)
TAND ([X=]x)
DTAND ([X=]x)
QTAND ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QTAN, TAND, DTAND, QTAND
DESCRIPTION
These functions evaluate y = tan(x). They are elemental intrinsic functions. They accept the following
argument:
x Must be of type real. For TAN, DTAN, and QTAN, x must be specified in radians and is treated
as modulo 2 * pi. For TAND, DTAND, and QTAND, x must be specified in degrees and is treated
as modulo 360.
TAN and TAND are generic function names; the rest are specifics.
A vector version of the single-precision and double-precision TAN intrinsic exists on IRIX systems and is
used when -O3 is specified on the compiler command line.
NOTES
The TAN and DTAN intrinsic function names can be passed as arguments; the others cannot.
On UNICOS and UNICOS/mk systems that support the IEEE standard for floating-point arithmetic, TAN(x)
25
yields NaN if x > pi * 2 .
On UNICOS systems that do not support the IEEE standard for floating-point arithmetic, TAN(x) yields 0 if
25
x > pi * 2 .
19
On IRIX systems, TAN(x) yields NaN if x > pi * 2 .
On all systems that support the IEEE standard for floating-point arithmetic, TAN(NaN) yields NaN.
RETURN VALUES
TAN and TAND return the real tangent of their real argument.
DTAN and DTAND return the double-precision real tangent of their double-precision real argument.
QTAN and QTAND return the quad-precision real tangent of their quad-precision real argument.
The terms single precision, double precision, and quad precision differ depending on your platform. For
platform-specific information, see the TERMINOLOGY section of the INTRO_INTRIN(3I) man page.
NAME
TANH, DTANH, QTANH – Computes hyperbolic tangent
SYNOPSIS
TANH ([X=]x)
DTANH ([X=]x)
QTANH ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
STANDARDS
Fortran
Fortran extension: QTANH
DESCRIPTION
The TANH, DTANH, and QTANH intrinsic functions compute the hyperbolic tangent of x. These functions
evaluate y = tanh(x). They are elemental functions. They accept the following argument:
x Must be of type real. The type and kind type of x is identical to the type and kind type of the
return value. See the RETURN VALUES section for information on input data types and return
values.
TANH is the generic function name; the others are specifics.
NOTES
The TANH and DTANH intrinsic function names can be passed as arguments; the other cannot.
On Cray T90 systems that support IEEE arithmetic, the following return values occur:
• If x > 19.1, TANH(x) yields 1.0.
• If x < – 19.1, TANH(x) yields -1.0.
• TANH(NaN) yields NaN.
RETURN VALUES
TANH returns the real hyperbolic tangent of its real argument.
DTANH returns the double-precision real hyperbolic tangent of its double-precision argument.
QTANH returns the quad-precision real hyperbolic tangent of its quad-precision argument.
NAME
TEST_IEEE_EXCEPTION – Returns the state of a floating-point exception
SYNOPSIS
TEST_IEEE_EXCEPTION ([EXCEPTION=]exception)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The TEST_IEEE_EXCEPTION intrinsic function returns the state of a specified floating-point exception. It
accepts the following argument:
exception Must be of an integer type that occupies a full word. If exception is an array, it must be
1-dimensional. The single value, in the scalar argument case, or each element, in the array
argument case, must be set to one of the values represented by the following named
constants:
• IEEE_XPTN_CRI_INVALID_OPND (valid only on Cray T90 systems that support
IEEE floating-point arithmetic)
• IEEE_XPTN_INEXACT_RESULT
• IEEE_XPTN_UNDERFLOW
• IEEE_XPTN_OVERFLOW
• IEEE_XPTN_DIV_BY_ZERO
• IEEE_XPTN_INVALID_OPR
• IEEE_XPTN_ALL (all exceptions in this list)
TEST_IEEE_EXCEPTION is an elemental function. The name of this intrinsic cannot be passed as an
argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN _IEEE_ DEF INI TIO NS
RETURN VALUES
The result type and type parameter is default logical. If exception is an array, the result is an array of the
same size.
If exception is scalar, the result is a default logical scalar that has the value TRUE if the specified
floating-point exception has occurred. It has the value FALSE if the specified floating-point exception has
not occurred.
If exception is an array, the result is a default logical 1-dimensional array of the same size as exception in
which an element has the value TRUE if the exception specified by the corresponding element of exception
has occurred. It has the value FALSE if the exception specified by the corresponding element of exception
has not occurred.
EXAMPLES
See the example on CLEAR_IEEE_EXCEPTION(3I).
SEE ALSO
CLEAR_IEEE_EXCEPTION(3I), GET_IEEE_EXCEPTIONS(3I), SET_IEEE_EXCEPTION(3I)
NAME
TEST_IEEE_INTERRUPT – Returns the state of a floating-point interrupt
SYNOPSIS
TEST_IEEE_INTERRUPT ([INTERRUPT=]interrupt)
IMPLEMENTATION
UNICOS/mk, IRIX systems, Cray T90 systems that support IEEE floating-point arithmetic
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The TEST_IEEE_INTERRUPT intrinsic function returns the state of a specified floating-point interrupt. It
accepts the following argument:
interrupt Must be of an integer type that occupies a full word. If interrupt is an array, it must be
1-dimensional. The single value in the scalar argument case, or each element in the array
argument case, must be set to one of the values represented by the following named
constants:
• IEEE_NTPT_CRI_INVALID_OPND (valid only on Cray T90 systems that support
IEEE floating-point arithmetic)
• IEEE_NTPT_INEXACT_RESULT
• IEEE_NTPT_UNDERFLOW
• IEEE_NTPT_OVERFLOW
• IEEE_NTPT_DIV_BY_ZERO
• IEEE_NTPT_INVALID_OPR
• IEEE_NTPT_ALL (all interrupts in this list)
Note that the values represented by these named constants are different from the
similarly-named named constants listed on TEST_IEEE_EXCEPTION(3I).
TEST_IEEE_INTERRUPT is an elemental function. The name of this intrinsic cannot be passed as an
argument.
NOTES
The IEEE intrinsic procedures use the named constants contained in a system module, so you must include
the following statement in your program:
USE FTN _IEEE_ DEF INI TIO NS
RETURN VALUES
The result type and type parameter are default logical. If interrupt is an array, the result is an array of the
same size.
If interrupt is scalar, the result has the value .TRUE. if the specified floating-point interrupt is enabled. It
has the value .FALSE. if the specified floating-point interrupt is disabled. If interrupt has the value
.IEEE_NTPT_ALL., the result has the value .TRUE. if all interrupts are enabled; otherwise its value is
.FALSE..
If interrupt is an array, each element of the result has the value .TRUE. if the interrupt specified by the
corresponding element of interrupt is enabled. It has the value .FALSE. if the interrupt specified by the
corresponding element of interrupt is disabled. If an element of interrupt has the value
.IEEE_NTPT_ALL., the corresponding element of the result has the value .TRUE. if all interrupts are
enabled; otherwise its value is .FALSE..
EXAMPLES
See the example on DISABLE_IEEE_INTERRUPT(3I).
SEE ALSO
DISABLE_IEEE_INTERRUPT(3I)
NAME
THIS_IMAGE – Retrieves an image number
SYNOPSIS
THIS_IMAGE([[ARRAY=]array[,[DIM=]dim]])
IMPLEMENTATION
UNICOS/mk systems
CF90
STANDARDS
Fortran extension
DESCRIPTION
THIS_IMAGE is an intrinsic procedure that allows an image to retrieve its own image number. It returns
the index of, or co-subscripts related to, the invoking image. It is an inquiry function. THIS_IMAGE
accepts the following arguments:
array The name of a co-array.
dim An integer value.
RETURN VALUES
The results differ, as follows, depending on the optional arguments specified:
• If array is absent, the result is a default integer scalar with a value equal to the index of the invoking
image.
• If array is present with a co-rank of one and dim is absent, the result is a default integer scalar with a
value equal to the co-subscript of the elements of array that reside on the invoking image.
• If array is present with a co-rank greater than one and dim is absent, the result is a rank one default
integer array of a size equal to the co-rank of array. Element k of the result has a value equal to the
co-subscript k of the elements of array that reside on the invoking image.
• If array and dim are present, the result is a default integer scalar with value equal to co-subscript dim of
the elements of array that reside on the invoking image.
EXAMPLES
Assume that the following declaration exists in a program:
REA L :: A(100) [8, 4]
The following table lists various THIS_IMAGE calls and the values they return on images 3 and 13:
Cal l Ima ge 3 Image 13
---- --- ---- --- --- --
THIS_IMAG E() 3 13
THIS_I MAGE(A ) (/ 3, 1 /) (/ 5, 2 /)
THIS_I MAG E(A ,1) 3 5
THIS_I MAG E(A ,2) 1 2
SEE ALSO
CF90 Co-array Programming Manual
NAME
TINY – Returns the smallest positive value for a real argument
SYNOPSIS
TINY ([X=]x)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The TINY intrinsic function returns the smallest positive number in the real number model that represents
number of the same type and kind type parameter as the argument. For more information on the real
number model, see the MODELS(3I) man page. It accepts the following argument:
x Must be of type real. It may be scalar or array valued.
TINY is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
e sub min-1
The result is a scalar with the same type and kind type parameter as x. The result has the value b ,
where b and e min (represented as "e sub min" in the previous equation) are as defined in the real number
model, which represents numbers of the same type and kind type parameter as x.
EXAMPLES
-8188
On UNICOS systems, TINY(X) has a value that approximates 2 for real X.
On Cray T90 systems that support IEEE arithmetic, TINY(X) has values that approximate the following:
• 2 -125 for real (KIND=4) X
• 2 -1021 for real (KIND=8) X
• 2 -16381 for real (KIND=16) X
On UNICOS/mk systems, TINY(X) has values that approximate the following:
• 2 -125 for real (KIND=4) X
• 2 -1021 for real (KIND=8) X
NAME
TRANSFER – Treats the first argument as if it is of the same type as the second argument
SYNOPSIS
TRANSFER ([SOURCE=]source, [MOLD=]mold [,[SIZE=]size])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The TRANSFER intrinsic function returns a result with the physical representation identical to that of source
but interpreted with the type and kind of mold. If mold is character, the result has the same character length
declared for mold. It accepts the following arguments:
source Can be of any type. It can be scalar or array valued.
mold Can be of any type. It can be scalar or array valued. This intrinsic function should not be used
if mold is a derived type with a pointer component; the result of this depends on your
implementation.
size Must be scalar and an integer.
TRANSFER is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result has the same type as mold.
If mold is scalar and size is not present, the result is a scalar.
If mold is array valued and size is not present, the result is an array of rank one. The size of the array is as
small as possible such that its physical representation is not shorter than that of source.
If size is present, the result is an array of rank one with an extent of size.
If the physical representation of the function result is the same length as source, the result is the entire
representation of source. If the physical representation of the function result is longer than source, the result
is the entire representation of source and the remainder of the result is undefined. If the physical
representation of the function result is shorter than source, the result is the leading part of source. If source
and mold are scalar entities and the size of mold is at least as long as source, the result must be the value of
source. For example, if source is an array and mold is a rank one array, E is the value of the following:
EXAMPLES
Example 1: TRANSFER(’abc’,’d’) yields a.
Example 2: Assume that A is the following real array: (/1.1,2.2,3.3/).
TRANSFER(A,(/(0.0,0.0)/)) yields a complex 1-dimensional array with one element: (1.1,2.2).
TRANSFER(A,(/(0.0,0.0)/),1) yields a complex rank one array with one element: (1.1,2.2).
NAME
TRANSPOSE – Transposes an array of rank two
SYNOPSIS
TRANSPOSE ([MATRIX=]matrix)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The TRANSPOSE intrinsic function transposes a two-dimensional array. It accepts the following argument:
matrix May be of any type and must have rank two
TRANSPOSE is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is an array of the same type and type parameters as matrix, with rank two, and shape (n, m),
where (m, n) is the shape of matrix. Element (i, j) of the result has the value matrix(j,i), where
i = 1, 2, . . ., n and j = 1, 2, . . ., m.
EXAMPLES
Assume that array A is as follows:
123
456
789
TRANSPOSE(A) yields the following value:
147
258
369
NAME
TRIM – Returns the character argument with trailing blank characters removed
SYNOPSIS
TRIM ([STRING=]string)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The TRIM intrinsic function removes trailing blank characters from its character argument. If the input
string contains trailing blank characters, it returns the string without the trailing blanks. If the string contains
only blanks, it returns a zero-length string. It accepts the following argument:
string Must be of type character and be a scalar
TRIM is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a scalar entity of type character with a length that is the length of string without any trailing
blank characters. The value of the result is the same as string except that any trailing blanks have been
removed. If string contains only blank characters, the result is a string of 0 length.
EXAMPLES
Consider the following example of a TRIM function reference. In this example, the carat (^) represents a
blank:
CHVAR = TRI M( ’^W ^O^ R^D ^^’ )
PRINT *,"CHV AR= ’", CHV AR, "’"
NAME
UBOUND – Returns all the upper bounds of an array or a specified upper bound
SYNOPSIS
UBOUND ([ARRAY=] array [,[DIM=]dim])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The UBOUND intrinsic function returns all the upper bounds of an array or returns a specified upper bound.
It accepts the following arguments:
array Can be of any type. It must not be scalar. It must not be a pointer that is disassociated or an
allocatable array that is not allocated. If array is an assumed-size array, dim must be present
with a value less than the rank of array.
dim Must be scalar and of type integer with a value in the range 1 ≤ dim ≤ n, where n is the rank of
array. The corresponding actual argument must not be an optional dummy argument.
UBOUND is an inquiry function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result type is default integer. It is scalar if dim is present; otherwise, the result is an array of rank one
and size n, where n is the rank of array.
For an array section or for an array expression, other than a whole array or array structure component,
UBOUND(array,dim) has a value equal to the number of elements in the given dimension. It has a value
equal to the upper bound for subscript dim of array if dimension dim of array does not have size zero; it has
the value zero if dimension dim has size zero.
UBOUND(array) has a value whose ith component is equal to UBOUND(array,i), for i = 1, 2, . . ., n, where
n is the rank of array.
EXAMPLES
Assume that A is declared by the statement REAL A(2:3, 7:10). In this case, the following are true:
• UBOUND(A) yields (/3,10/).
• UBOUND(A,DIM=2) yields 10.
NAME
UNIT – Returns the status of a BUFFER IN or BUFFER OUT statement
SYNOPSIS
UNIT ([I=]i)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran extension
DESCRIPTION
After execution of asynchronous I/O with a BUFFER IN or BUFFER OUT statement, the execution
sequence continues concurrently with the data transfer. If UNIT is called in this execution sequence, the
sequence is delayed until the transfer is complete. After the BUFFER IN operation, use UNIT or
LENGTH(3I) before using memory locations where the data is stored. UNIT accepts the following argument:
i Must be an integer or Boolean value. Represents a unit number.
UNIT is an elemental function. The name of this intrinsic cannot be passed as an argument.
NOTES
On UNICOS and UNICOS/mk systems, UNIT can be called as either an external subprogram or as an
intrinsic procedure.
On IRIX systems, the BUFFER IN and BUFFER OUT statements are used for synchronous I/O.
Asynchronous I/O is not available through BUFFER I/O on IRIX systems.
RETURN VALUES
When the transfer is complete, UNIT returns a value of type real. The value is of type REAL(KIND=8) on
UNICOS and UNICOS/mk systems; it is of type REAL(KIND=4) on IRIX systems. The returned value has
one of the following meanings:
Value Meaning
– 2.0 A partial-record read terminated after delivering the requested number of words or characters,
but more data remains in the record. This status can be received only after a BUFFER IN in
partial record mode.
– 1.0 Operation was completed (indicates one of the following):
• A full- or partial-record BUFFER OUT operation completed.
• A full-record BUFFER IN completed, transferring as much of the record as would fit in the
space provided.
• A partial-record BUFFER IN completed, transferring as much data as was left in the record
(no more data remains in the record).
• UNIT was called for an unconnected unit or for a unit on which no BUFFER IN or
BUFFER OUT operations have been performed.
0.0 An end-of-file was encountered on the previous BUFFER IN operation. No data was
transferred.
1.0 A partially recovered error occurred on the previous BUFFER IN operation. Use the LENGTH
function to determine how much data was transferred.
2.0 An unrecovered error occurred on the last BUFFER IN or BUFFER OUT operation.
EXAMPLES
SEE ALSO
LENGTH(3I)
NAME
UNPACK – Unpacks an array of rank one into an array under control of a mask
SYNOPSIS
UNPACK ([VECTOR=]vector, [MASK=]mask, [FIELD=]field)
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The UNPACK intrinsic function unpacks an array of rank one into an array under control of mask. It accepts
the following arguments:
vector Can be of any type. It must have rank one. Its size must be at least t where t is the number of
true elements in mask.
mask Must be of type logical and array valued.
field Must be of the same type as vector, and must be conformable with mask.
UNPACK is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is an array of the same type as vector and the same shape as mask.
The element of the result that corresponds to the ith true element of mask, in array element order, has the
value vector(i) for i=1, 2, . . ., t where t is the number of true values in mask. Each other element has the
value equal to field if field is scalar or to the corresponding element of field if it is an array.
EXAMPLES
This example uses UNPACK to scatter specific values to specific positions in an array.
Assume that M is the following array:
100
010
001
NAME
VERIFY – Verifies that a set of characters contains all characters in a string
SYNOPSIS
VERIFY ([STRING=]string, [SET=]set [,[BACK=]back])
IMPLEMENTATION
UNICOS, UNICOS/mk, IRIX systems
CF90, MIPSpro 7 Fortran 90
STANDARDS
Fortran
DESCRIPTION
The VERIFY intrinsic function verifies that a set of characters contains all characters in a string by
identifying the first character position in a string of characters that does not appear in a given set of
characters. VERIFY accepts the following arguments:
string Must be of type character variable.
set Must be of type character variable, expression, or constant.
back Must be of type logical. If back is omitted, a value of false is assumed.
VERIFY is an elemental function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is an integer.
If back is absent or is present with a value FALSE and string contains at least one character that is not in
set, the value of the result is the position of the leftmost character of string that is not in set.
If back is present with a value TRUE and if string contains at least one character that is not in set, the value
of the result is the position of the rightmost character of string that is not in set.
VERIFY returns 0 if each character in string is in set, or if the length of string is 0.
EXAMPLES
VERIFY(’ABBA’,’A’) yields 2.
VERIFY(’ABBA’,’A’,BACK=.TRUE.) yields 3.
VERIFY(’ABBA’,’AB’) yields 0.
NAME
_write_memory_barrier, WRITE_MEMORY_BARRIER – Blocks processor until previous store
operations have finished
SYNOPSIS
C/C++:
#include <intrinsics.h>
void _write_memory_barrier (void);
Fortran:
WRITE_MEMORY_BARRIER ()
IMPLEMENTATION
UNICOS/mk systems
Cray C/C++, CF90
STANDARDS
C/C++ extension
Fortran extension
DESCRIPTION
This intrinsic guarantees that all preceding store instructions have completed modifying memory before any
subsequent loads or stores reference memory.
NOTES
C/C++
Because _write_memory_barrier is an intrinsic function, no externally visible library function is
available for it. The compiler generates inline code to produce the result.
Fortran
The name of this intrinsic cannot be passed as an argument.
SEE ALSO
A complete list of C/C++ intrinsic functions available on UNICOS and UNICOS/mk systems is in the Cray
C/C++ Reference Manual.