7 February 2011 9:11:28.682 AM F77_INTRINSICS FORTRAN77 version Test FORTRAN77 intrinsic library. TEST_ABS ABS is a FORTRAN77 function which returns the absolute value of a numeric quantity Type VALUE ABS(VALUE) integer -88 88 Real 45.7800 45.7800 Double precision 45.7800 45.7800 Complex 1.0000 -2.0000 2.2361 TEST_ACOS ACOS is a FORTRAN77 function which returns the inverse cosine of a value between -1 and 1 X ACOS(X) COS(ACOS(X)) -0.563163 2.16901 -0.563163 0.912635 0.421111 0.912635 0.659018 0.851283 0.659018 0.123391 1.44709 0.123391 -0.169386 1.74100 -0.169386 -0.867763 2.62148 -0.867763 -0.484844 2.07698 -0.484844 -0.780086 2.46560 -0.780086 -0.912342 2.71976 -0.912342 0.267931 1.29955 0.267931 TEST_AIMAG AIMAG is a FORTRAN77 function which returns the imaginary part of a complex number. X AIMAG(X) 0.449860 -0.126667 -0.126667 -0.843197 -0.344280 -0.344280 0.589627 0.260090 0.260090 0.391140 0.323400 0.323400 -0.139466 -0.156136 -0.156136 -0.236066 0.077459 0.077459 0.018599 -0.633214 -0.633214 0.892850 0.010314 0.010314 -0.560465 0.763795 0.763795 0.306357 0.026275 0.026275 TEST_AINT AINT is a FORTRAN77 function which returns the value of a real number rounded towards zero. X AINT(X) -5.63163 -5.00000 9.12635 9.00000 6.59018 6.00000 1.23391 1.00000 -1.69386 -1.00000 -8.67763 -8.00000 -4.84844 -4.00000 -7.80086 -7.00000 -9.12342 -9.00000 2.67931 2.00000 TEST_ANINT ANINT is a FORTRAN77 function which returns, as a real value, the nearest integer to a given real number. X ANINT(X) -5.63163 -6.00000 9.12635 9.00000 6.59018 7.00000 1.23391 1.00000 -1.69386 -2.00000 -8.67763 -9.00000 -4.84844 -5.00000 -7.80086 -8.00000 -9.12342 -9.00000 2.67931 3.00000 TEST_ASIN ASIN is a FORTRAN77 function which returns the inverse sine of a value between -1 and 1 X ASIN(X) SIN(ASIN(X)) -0.563163 -0.598209 -0.563163 0.912635 1.14968 0.912635 0.659018 0.719513 0.659018 0.123391 0.123706 0.123391 -0.169386 -0.170206 -0.169386 -0.867763 -1.05068 -0.867763 -0.484844 -0.506185 -0.484844 -0.780086 -0.894804 -0.780086 -0.912342 -1.14897 -0.912342 0.267931 0.271245 0.267931 TEST_ATAN ATAN is a FORTRAN77 function which returns the inverse tangent of a value X ATAN(X) TAN(ATAN(X)) -5.63163 -1.39506 -5.63163 9.12635 1.46166 9.12635 6.59018 1.42020 6.59018 1.23391 0.889726 1.23391 -1.69386 -1.03749 -1.69386 -8.67763 -1.45606 -8.67763 -4.84844 -1.36740 -4.84844 -7.80086 -1.44330 -7.80086 -9.12342 -1.46162 -9.12342 2.67931 1.21358 2.67931 TEST_ATAN2 ATAN2 is a FORTRAN77 function which returns the inverse tangent of a value X Y ATAN2(Y,X) TAN(ATAN2(Y,X)) -5.63163 9.12635 2.12368 -1.62055 6.59018 1.23391 0.185091 0.187234 -1.69386 -8.67763 -1.76357 5.12299 -4.84844 -7.80086 -2.12689 1.60894 -9.12342 2.67931 2.85595 -0.293674 -8.76546 -1.00922 -3.02696 0.115136 -1.97387 5.09347 1.94051 -2.58044 5.94574 -9.96323 -1.03276 -1.67569 7.95008 -2.98495 -0.359176 -0.375462 -8.10910 -9.72766 -2.26570 1.19960 TEST_BTEST BTEST(I,POS) is a FORTRAN77 function which is TRUE if bit POS of I is 1. Here, we are only going to check the lowest 32 bits. I POS BTEST(I,POS) 213456 0 F 213456 1 F 213456 2 F 213456 3 F 213456 4 T 213456 5 F 213456 6 T 213456 7 T 213456 8 T 213456 9 F 213456 10 F 213456 11 F 213456 12 F 213456 13 F 213456 14 T 213456 15 F 213456 16 T 213456 17 T 213456 18 F 213456 19 F 213456 20 F 213456 21 F 213456 22 F 213456 23 F 213456 24 F 213456 25 F 213456 26 F 213456 27 F 213456 28 F 213456 29 F 213456 30 F 213456 31 F The binary representation of 213456 is: "00000000000000110100000111010000". I POS BTEST(I,POS) -28 0 F -28 1 F -28 2 T -28 3 F -28 4 F -28 5 T -28 6 T -28 7 T -28 8 T -28 9 T -28 10 T -28 11 T -28 12 T -28 13 T -28 14 T -28 15 T -28 16 T -28 17 T -28 18 T -28 19 T -28 20 T -28 21 T -28 22 T -28 23 T -28 24 T -28 25 T -28 26 T -28 27 T -28 28 T -28 29 T -28 30 T -28 31 T The binary representation of -28 is: "11111111111111111111111111100100". TEST_CHAR CHAR is a FORTRAN77 function which returns the character of given character index. I CHAR(I) 32 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ TEST_CMPLX CMPLX is a FORTRAN77 function which returns the complex number formed by real and imaginary parts. CMPLX(1) 1.000000 0.000000 CMPLX(2,3) 2.000000 3.000000 CMPLX(4.5) 4.500000 0.000000 CMPLX(6.7, 8.9 ) 6.700000 8.900000 TEST_CONJG CONJG is a FORTRAN77 function which returns the conjugate of a complex number. X CONJG(X) -------------------------- ---------------------------- 0.449860 -0.126667 0.449860 0.126667 -0.843197 -0.344280 -0.843197 0.344280 0.589627 0.260090 0.589627 -0.260090 0.391140 0.323400 0.391140 -0.323400 -0.139466 -0.156136 -0.139466 0.156136 -0.236066 0.077459 -0.236066 -0.077459 0.018599 -0.633214 0.018599 0.633214 0.892850 0.010314 0.892850 -0.010314 -0.560465 0.763795 -0.560465 -0.763795 0.306357 0.026275 0.306357 -0.026275 TEST_COS_C4 COS is a FORTRAN77 function which returns the cosine of a real or complex number. Here we use complex arguments. X COS(X) -------------------------- ---------------------------- 0.449860 -0.126667 0.907742 0.552274E-01 -0.843197 -0.344280 0.704885 -0.262208 0.589627 0.260090 0.859419 -0.146260 0.391140 0.323400 0.973242 -0.125454 -0.139466 -0.156136 1.00239 -0.217933E-01 -0.236066 0.774594E-01 0.975184 0.181343E-01 0.185991E-01 -0.633214 1.20706 0.125795E-01 0.892850 0.103136E-01 0.627228 -0.803302E-02 -0.560465 0.763795 1.10632 0.446663 0.306357 0.262752E-01 0.953768 -0.792518E-02 TEST_COS_R8 COS is a FORTRAN77 function which returns the cosine of a real or complex number. Here we use double precision arguments. X COS(X) -5.63163 0.795144 9.12635 -0.955800 6.59018 0.953245 1.23391 0.330551 -1.69386 -0.122752 -8.67763 -0.733627 -4.84844 0.135636 -7.80086 0.530925E-01 -9.12342 -0.954934 2.67931 -0.895039 TEST_COSH COSH is a FORTRAN77 function which returns the hyperbolic cosine of a real number. X COSH(X) -5.63163 139.561 9.12635 4597.21 6.59018 363.958 1.23391 1.86289 -1.69386 2.81212 -8.67763 2935.05 -4.84844 63.7748 -7.80086 1221.36 -9.12342 4583.75 2.67931 7.32185 TEST_DBLE DBLE is a FORTRAN77 function which converts a complex, integer or real value to double precision real Type X DBLE(X) complex 1.1000 2.2000 1.1000 integer 5 5.0000 real 7.7000 7.7000 double precision 8.8000 8.8000 TEST_DIM DIM is a FORTRAN77 function which returns the maximum of X-Y or 0. Arithmetic type: integer X, Y X Y DIM(X,Y) 22 96 0 83 56 27 41 6 35 26 11 15 4 64 0 TEST_DPROD DPROD is a FORTRAN77 function which returns the product of real values X and Y, using double precision. real x, y X Y DPROD(X,Y) 21.841829 95.631760 2088.772570 82.950928 56.169544 4659.315803 41.530708 6.611873 274.595775 25.757780 10.995679 283.224279 4.382900 63.396572 277.860821 TEST_EXP EXP is a FORTRAN77 function which returns the exponential of a real number. X EXP(X) -5.63163 0.358272E-02 9.12635 9194.42 6.59018 727.915 1.23391 3.43463 -1.69386 0.183809 -8.67763 0.170355E-03 -4.84844 0.784057E-02 -7.80086 0.409381E-03 -9.12342 0.109081E-03 2.67931 14.5751 TEST_IAND_I4 IAND is a FORTRAN77 function which returns the bitwise AND of two integers. Here, I and J are integers. I J IAND(I,J) 22 96 0 83 56 16 41 6 0 26 11 10 4 64 0 6 45 4 40 76 8 80 0 0 90 35 2 9 1 1 TEST_IBCLR IBCLR is a FORTRAN77 function which sets a given bit to zero in an integer word. I POS IBCLR(I,POS) 2047 0 2046 2047 1 2045 2047 2 2043 2047 3 2039 2047 4 2031 2047 5 2015 2047 6 1983 2047 7 1919 2047 8 1791 2047 9 1535 2047 10 1023 TEST_IBITS IBITS is a FORTRAN77 function which extracts LEN bits from word I start at position POS. I POS LEN IBITS(I,POS,LEN) 1396 0 3 4 1396 1 3 2 1396 2 3 5 1396 3 3 6 1396 4 3 7 1396 5 3 3 1396 6 3 5 1396 7 3 2 1396 8 3 5 1396 9 3 2 1396 10 3 1 1396 2 1 1 1396 2 2 1 1396 2 3 5 1396 2 4 13 1396 2 5 29 1396 2 6 29 1396 2 7 93 1396 2 8 93 1396 2 9 349 1396 2 10 349 Use IBITS to extract the 4 bytes that make up an integer word. I4 = 1040503311 Byte 0 = 15 Byte 1 = 210 Byte 2 = 4 Byte 3 = 62 TEST_IBSET IBSET is a FORTRAN77 function which sets a given bit to one in an integer word. I POS IBSET(I,POS) 0 0 1 1 1 3 3 2 7 7 3 15 15 4 31 31 5 63 63 6 127 127 7 255 255 8 511 511 9 1023 1023 10 2047 TEST_ICHAR ICHAR is a FORTRAN77 function which returns the character index of a given character C ICHAR(C) CHAR(ICHAR(C)) T 84 T h 104 h i 105 i s 115 s 32 i 105 i s 115 s 32 a 97 a 32 s 115 s t 116 t r 114 r i 105 i n 110 n g 103 g 32 o 111 o f 102 f 32 t 116 t e 101 e x 120 x t 116 t ! 33 ! TEST_IEOR_I4 IEOR is a FORTRAN77 function which returns the bitwise exclusive OR of two integers. Here, I and J are integers. I J IEOR(I,J) 22 96 118 83 56 107 41 6 47 26 11 17 4 64 68 6 45 43 40 76 100 80 0 80 90 35 121 9 1 8 TEST_INDEX INDEX(S,SUB) is a FORTRAN77 function which returns the location of the first occurrence of substring SUB in string S. index ( 'THE CATATONIC CAT', 'CAT' ) 5 index ( 'THE CATATONIC CAT', 'cat' ) 0 TEST_INT INT is a FORTRAN77 function which converts a complex, integer or real value to integer. Type X INT(X) complex 1.1000 2.2000 1 integer 5 5 real 7.7000 7 double precision 8.8000 8 TEST_IOR_I4 IOR is a FORTRAN77 function which returns the bitwise inclusive OR of two integers. Here, I and J are integers. I J IOR(I,J) 22 96 118 83 56 123 41 6 47 26 11 27 4 64 68 6 45 47 40 76 108 80 0 80 90 35 123 9 1 9 TEST_ISHFT ISHFT is a FORTRAN77 function which shifts the bits in an integer word. I SHIFT ISHFT(I,SHIFT) 89 -5 2 89 -4 5 89 -3 11 89 -2 22 89 -1 44 89 0 89 89 1 178 89 2 356 89 3 712 89 4 1424 89 5 2848 TEST_ISHFTC ISHFTC is a FORTRAN77 function which circular-shifts the bits in an integer word. I SHIFT ISHFTC(I,SHIFT,SIZE) 89 -5 -939524094 89 -4 -1879048187 89 -3 536870923 89 -2 1073741846 89 -1 -2147483604 89 0 89 89 1 178 89 2 356 89 3 712 89 4 1424 89 5 2848 TEST_LEN LEN is a FORTRAN77 function which returns the declared length of a string variable, or the length of a string constant S LEN(S) ---------- ----- character*1 1 character*2 2 character*4 4 character*8 8 character*16 16 "A STRING" 8 TEST_LEN_TRIM LEN_TRIM is a FORTRAN77 function which returns the "used" length of a string variable up to the last nonblank. S LEN_TRIM(S) ---------- ---------- "1234567890" 10 "12345 " 5 " 67890" 10 " 5 " 5 "1 3 5 7 9 " 9 TEST_LGE LGE is a FORTRAN77 function which returns the value of "S1 >= S2" where S1 and S2 are strings. S1 S2 LGE(S1,S2) --- --- ---------- "boy" "boy" T "boy" "cat" F "cat" "boy" T "cat" "dog" F "cat" "CAT" T "cat" "cats" F TEST_LGT LGT is a FORTRAN77 function which returns the value of "S1 > S2" where S1 and S2 are strings. S1 S2 LGT(S1,S2) --- --- ---------- "boy" "boy" F "boy" "cat" F "cat" "boy" T "cat" "dog" F "cat" "CAT" T "cat" "cats" F TEST_LLE LLE is a FORTRAN77 function which returns the value of "S1 <= S2" where S1 and S2 are strings. S1 S2 LLE(S1,S2) --- --- ---------- "boy" "boy" T "boy" "cat" T "cat" "boy" F "cat" "dog" T "cat" "CAT" F "cat" "cats" T TEST_LGT LLT is a FORTRAN77 function which returns the value of "S1 < S2" where S1 and S2 are strings. S1 S2 LLT(S1,S2) --- --- ---------- "boy" "boy" F "boy" "cat" T "cat" "boy" F "cat" "dog" T "cat" "CAT" F "cat" "cats" T TEST_LOG LOG is a FORTRAN77 function which returns the natural logarithm of a real number. X LOG(X) EXP(LOG(X)) 2.18418 0.781242 2.18418 9.56318 2.25792 9.56318 8.29509 2.11566 8.29509 5.61695 1.72579 5.61695 4.15307 1.42385 4.15307 0.661187 -0.413718 0.661187 2.57578 0.946152 2.57578 1.09957 0.949173E-01 1.09957 0.438290 -0.824875 0.438290 6.33966 1.84682 6.33966 TEST_LOG10 LOG10 is a FORTRAN77 function which returns the base 10 logarithm of a real number. X LOG10(X) 10**(LOG(X)) 2.18418 0.339289 2.18418 9.56318 0.980602 9.56318 8.29509 0.918821 8.29509 5.61695 0.749501 5.61695 4.15307 0.618369 4.15307 0.661187 -0.179675 0.661187 2.57578 0.410908 2.57578 1.09957 0.412221E-01 1.09957 0.438290 -0.358238 0.438290 6.33966 0.802066 6.33966 TEST_MAX MAX is a FORTRAN77 function which returns the maximum value in a list. max(2,1) = 2 max(1,3,2) = 3 max(3,2,4,1) = 4 max(2.1, 1.2) = 2.1 max(1.1, 3.2, 2.3) = 3.2 max(3.1, 2.2, 4.3, 1.4) = 4.3 TEST_MIN MIN is a FORTRAN77 function which returns the minimum value in a list. min(3, 4) = 3 min(4, 2, 3) = 2 min(2, 3, 1, 4) = 1 min(3.1, 4.2) = 3.1 min(4.1. 2.2, 3.3) = 2.2 min(2.1, 3.2, 1.3, 4.4) = 1.3 TEST_MOD_I4 MOD is a FORTRAN77 function which returns the remainder after division. Here, the arguments are integers. I J MOD(I,J) -4 19 -4 15 7 1 2 -8 2 -3 -7 -3 -9 9 0 -9 3 0 2 13 2 14 -10 4 17 0 Undefined -8 -10 -8 TEST_MOD_R4 MOD is a FORTRAN77 function which returns the remainder after division. Here, the arguments are reals. X Y MOD(X,Y) -3.447451 18.689528 -3.447451 14.885277 6.850864 1.183548 2.459212 -8.016438 2.459212 -2.272666 -6.701296 -2.272666 -8.685130 9.018972 -8.685130 -8.148183 3.486168 -1.175847 2.039188 12.640205 2.039188 13.918608 -9.944849 3.973759 16.925121 0.522570 0.202892 -7.163657 -9.591494 -7.163657 TEST_MVBITS MVBITS is a FORTRAN77 function which extracts bits from one place and copies them elsewhere. CALL MVBITS(FROM,FROMPOS,LEN,TO,TOPOS) We will always use I1 = 1396 We will always start with I2 = 0 CALL MVBITS(I1,0, 5,I2,0): I2 = 20 CALL MVBITS(I1,0,32,I2,0): I2 = 1396 CALL MVBITS(I1,5, 5,I2,0): I2 = 11 CALL MVBITS(I1,5, 5,I2,5): I2 = 352 TEST_NINT NINT is a FORTRAN77 function which returns, as an integer, the nearest integer to a given real number. X NINT(X) -5.63163 -6 9.12635 9 6.59018 7 1.23391 1 -1.69386 -2 -8.67763 -9 -4.84844 -5 -7.80086 -8 -9.12342 -9 2.67931 3 TEST_NOT_I4 NOT is a FORTRAN77 function which returns the bitwise NOT of an integer. Here, I is an integer. I NOT(I) 22 -23 96 -97 83 -84 56 -57 41 -42 6 -7 26 -27 11 -12 4 -5 64 -65 TEST_REAL_C4 REAL is a FORTRAN77 function which returns the real part of a complex number. X REAL(X) ------------------------ ---------------- 0.449860 -0.126667 0.449860 -0.843197 -0.344280 -0.843197 0.589627 0.260090 0.589627 0.391140 0.323400 0.391140 -0.139466 -0.156136 -0.139466 -0.236066 0.077459 -0.236066 0.018599 -0.633214 0.018599 0.892850 0.010314 0.892850 -0.560465 0.763795 -0.560465 0.306357 0.026275 0.306357 TEST_SIGN SIGN is a FORTRAN77 function which returns the sign of Y times the magnitude of X. X Y SIGN(X,Y) -5.63163 9.12635 5.63163 6.59018 1.23391 6.59018 -1.69386 -8.67763 -1.69386 -4.84844 -7.80086 -4.84844 -9.12342 2.67931 9.12342 -8.76546 -1.00922 -8.76546 -1.97387 5.09347 1.97387 5.94574 -9.96323 -5.94574 7.95008 -2.98495 -7.95008 -8.10910 -9.72766 -8.10910 TEST_SIN_R8 SIN is a FORTRAN77 function which returns the sine of a real or complex number. Here we use double precision arguments. X SIN(X) -5.63163 0.606421 9.12635 0.294017 6.59018 0.302200 1.23391 0.943788 -1.69386 -0.992437 -8.67763 -0.679553 -4.84844 0.990759 -7.80086 -0.998590 -9.12342 -0.296817 2.67931 0.445989 TEST_SINH SINH is a FORTRAN77 function which returns the hyperbolic sine of a real number. X SINH(X) -5.63163 -139.557 9.12635 4597.21 6.59018 363.957 1.23391 1.57174 -1.69386 -2.62831 -8.67763 -2935.05 -4.84844 -63.7670 -7.80086 -1221.36 -9.12342 -4583.75 2.67931 7.25324 TEST_SQRT SQRT is a FORTRAN77 function which returns the square root of a real number. X SQRT(X) (SQRT(X))**2 2.18418 1.47790 2.18418 9.56318 3.09244 9.56318 8.29509 2.88012 8.29509 5.61695 2.37001 5.61695 4.15307 2.03791 4.15307 0.661187 0.813134 0.661187 2.57578 1.60492 2.57578 1.09957 1.04860 1.09957 0.438290 0.662035 0.438290 6.33966 2.51787 6.33966 TEST_TAN TAN is a FORTRAN77 function which returns the tangent of a real number. X TAN(X) -5.63163 0.762655 9.12635 -0.307613 6.59018 0.317022 1.23391 2.85520 -1.69386 8.08492 -8.67763 0.926292 -4.84844 7.30455 -7.80086 -18.8085 -9.12342 0.310825 2.67931 -0.498290 TEST_TANH TANH is a FORTRAN77 function which returns the hyperbolic tangent of a real number. X TANH(X) -5.63163 -0.999974 9.12635 1.00000 6.59018 0.999996 1.23391 0.843709 -1.69386 -0.934637 -8.67763 -1.00000 -4.84844 -0.999877 -7.80086 -1.00000 -9.12342 -1.00000 2.67931 0.990629 F77_INTRINSICS Normal end of execution. 7 February 2011 9:11:28.685 AM