28 September 2014 12:46:28.993 PM R4LIB_PRB FORTRAN77 version Test the R4LIB library. TEST001 R4_ABS returns the absolute value of an R4. -1.252654 1.252654 4.650541 4.650541 3.636074 3.636074 1.493564 1.493564 0.322457 0.322457 -2.471050 2.471050 -0.939378 0.939378 -2.120346 2.120346 -2.649368 2.649368 2.071726 2.071726 TEST002 R4_ATAN computes the arc-tangent given Y and X; ATAN2 is the system version of this routine. X Y ATAN2(Y,X) R4_ATAN(Y,X) 1.00000 0.00000 0.00000 0.00000 1.00000 1.00000 0.785398 0.785398 0.00000 1.00000 1.57080 1.57080 -1.00000 1.00000 2.35619 2.35619 -1.00000 0.00000 3.14159 3.14159 -1.00000 -1.00000 -2.35619 3.92699 0.00000 -1.00000 -1.57080 4.71239 1.00000 -1.00000 -0.785398 5.49779 TEST003 R4_CAS evaluates the casine of a number. X R4_CAS ( X ) 0.00000 1.00000 0.261799 1.22474 0.523599 1.36603 0.785398 1.41421 1.04720 1.36603 1.30900 1.22474 1.57080 1.00000 1.83260 0.707107 2.09440 0.366025 2.35619 0.00000 2.61799 -0.366026 2.87979 -0.707107 3.14159 -1.00000 TEST004 R4_CEILING rounds a value up. -1.20000 -1 -1.00000 -1 -0.800000 0 -0.600000 0 -0.400000 0 -0.200000 0 0.00000 0 0.200000 1 0.400000 1 0.600000 1 0.800000 1 1.00000 1 1.20000 2 TEST005 R4_DIFF computes a difference X-Y to a given number of binary places. For this test, we use 3 binary places. X Y X-Y R4_DIFF(X,Y) 1.0000 0.0625 0.9375 0.8750 1.0000 0.1250 0.8750 0.8750 1.0000 0.2500 0.7500 0.7500 1.0000 0.5000 0.5000 0.5000 1.0000 0.8740 0.1260 0.1250 1.0000 0.8760 0.1240 0.1250 1.0000 0.9000 0.1000 0.1250 1.0000 0.9500 0.0500 0.0000 1.0000 0.9900 0.0100 0.0000 1.0000 1.0000 0.0000 0.0000 1.0000 1.0100 -0.0100 0.0000 1.0000 1.0500 -0.0500 0.0000 1.0000 1.1000 -0.1000 -0.1375 1.0000 3.0000 -2.0000 -1.8750 1.0000 10.0000 -9.0000 -8.7500 TEST006 R4_DIGIT extracts decimal digits. Here, we get digits of 3.141592741012573 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0 0 0 3 1 4 1 5 9 2 7 4 1 0 1 2 5 7 3 2 4 2 1 TEST007 R4_EPSILON produces the R4 machine precision. R = R4_EPSILON() = 0.119209E-06 ( 1 + R ) - 1 = 0.119209E-06 ( 1 + (R/2) ) - 1 = 0.00000 TEST008 R4_FRACTION returns the fraction part of an R4. -1.252654 -0.996111 4.650541 0.999324 3.636074 0.996658 1.493564 0.986410 0.322457 0.969360 -2.471050 -0.988507 -0.939378 -0.999004 -2.120346 -0.989863 -2.649368 -0.987817 2.071726 0.990606 TEST009 R4_HUGE returns a "huge" R4; R4_HUGE ( ) = 0.3402823466385289E+39 TEST023 R4_SIGN returns the sign of an R4. R4_SIGN3 returns the three-way sign of an R4. R4 R4_SIGN(R4) R4_SIGN3(R4) -1.2500 -1. -1. -0.2500 -1. -1. 0.0000 1. 0. 0.5000 1. 1. 9.0000 1. 1. TEST0235 R4_SWAP swaps two reals. Before swapping: X = 1.00000 Y = 3.14159 After swapping: X = 3.14159 Y = 1.00000 TEST027 R4_UNIFORM_01 produces a sequence of random values. Using random seed 123456789 SEED R4_UNIFORM_01(SEED) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.661187E-01 553144097 0.257578 236130416 0.109957 94122056 0.438290E-01 1361431000 0.633966 Verify that the sequence can be restarted. Set the seed back to its original value, and see that we generate the same sequence. SEED R4_UNIFORM_01(SEED) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.661187E-01 553144097 0.257578 236130416 0.109957 94122056 0.438290E-01 1361431000 0.633966 TEST028 R4_UNIFORM_01 samples a uniform random distribution in [0,1]. Starting with seed = 123456789 First few values: 1 0.218418 2 0.956318 3 0.829509 4 0.561695 5 0.415307 Number of values computed was N = 1000 Average value was 0.503040 Minimum value was 0.183837E-02 Maximum value was 0.997908 Variance was 0.823320E-01 TEST12555 R4VEC_INDICATOR0 returns an indicator vector. The indicator0 vector: 1: 0.0000000 2: 1.0000000 3: 2.0000000 4: 3.0000000 5: 4.0000000 6: 5.0000000 7: 6.0000000 8: 7.0000000 9: 8.0000000 10: 9.0000000 TEST137 R4VEC_SORT_BUBBLE_A ascending sorts a R4VEC. Original array: 1: 13.1051 2: 57.3791 3: 49.7706 4: 33.7017 5: 24.9184 6: 3.96712 7: 15.4547 8: 6.59741 ...... .............. 20: 0.817014 Ascending sorted array: 1: 0.110302 2: 0.817014 3: 2.62974 4: 3.70363 5: 3.96712 6: 5.67269 7: 6.59741 8: 13.1051 ...... .............. 20: 57.3791 R4LIB_PRB Normal end of execution. 28 September 2014 12:46:28.994 PM