ANS FORTH CELEFUNT TEST RESULTS FOR SIN(Z), COS(Z) zsincos.fs vs. 0.9.3 dnw 19Jan05 These results were obtained with pfe 0.33.58 compiled with gcc 3.3.3 on my MacOS X 10.3.7, PowerMac dual G4 system. Leaving aside the pfe C-primitive tests, Gforth 0.6.2 gives the same results as pfe on the same system, except for the way NaN and Inf are treated. Results from Cody's original Fortran code are included for reference. It was compiled with GNU Fortran (GCC) 3.4 20031015 (experimental) under MacOS X. The "normal" version calls complex.fs vs. 0.8.2, Julian Noble's original code for ZSIN and ZCOS. The "kahan" version calls complex-kahan.fs vs. 0.8.7, which uses the Kahan algorithm without treatment of IEEE 754 underflow/overflow exceptions. The "pfe prim" version calls the pfe complex module vs. 0.8.7, which codes the Kahan algorithm in C with treatment of underflow/overflow exceptions. This module is part of the pfe 0.33.xx series distribution. Each test has three sections corresponding to the magnitude of the relative complex difference of the compared functions, the relative error in the real part, and the relative error in the imaginary part. N= = number out of 2000 random trials that are equal MRE = maximum relative error RMS = rms relative error ULP = estimated units in last place (loss of base 2 significant digits) Floating point numbers have 53 significant bits, with at most 7 significant decimal digits printed out below. The complex numbers following "box" are opposite corners of the box in the complex plane from which random values of z are chosen. sin[z] vs. sin[w]*cos[del] + cos[w]*sin[del], z = w + del, del = 1/16 + i*1/16 box 6.250E-02+i0, 1+i1 N= MRE ULP RMS ULP vector g77 386 4.42E-16 1.99 1.41E-16 0.34 normal 338 5.28E-16 2.25 1.47E-16 0.40 kahan 360 5.28E-16 2.25 1.45E-16 0.38 pfe prim 350 5.28E-16 2.25 1.47E-16 0.41 real g77 884 4.46E-16 2.01 1.42E-16 0.36 normal 836 5.29E-16 2.25 1.48E-16 0.41 kahan 876 5.29E-16 2.25 1.44E-16 0.38 pfe prim 859 5.29E-16 2.25 1.48E-16 0.41 imaginary g77 na na na na na normal 823 1.79E-14 7.33 5.64E-16 2.35 kahan 840 1.79E-14 7.33 5.72E-16 2.37 pfe prim 825 3.36E-14 8.24 9.49E-16 3.10 sin[z] vs. sin[w]*cos[del] + cos[w]*sin[del], z = w + del, del = 1/16 + i*1/16 box 16+i16, 17+i17 N= MRE ULP RMS ULP vector g77 419 4.13E-16 1.90 1.39E-16 0.32 normal 379 4.13E-16 1.90 1.48E-16 0.42 kahan 380 4.13E-16 1.90 1.47E-16 0.41 pfe prim 377 4.13E-16 1.90 1.48E-16 0.41 real g77 948 4.84E-16 2.12 1.38E-16 0.31 normal 904 4.86E-16 2.13 1.45E-16 0.39 kahan 914 4.86E-16 2.13 1.43E-16 0.36 pfe prim 907 4.86E-16 2.13 1.45E-16 0.39 imaginary g77 879 5.11E-16 2.20 1.43E-16 0.36 normal 840 5.57E-16 2.33 1.53E-16 0.46 kahan 837 5.57E-16 2.33 1.53E-16 0.46 pfe prim 851 5.57E-16 2.33 1.51E-16 0.44 cos[z] vs. cos[w]*cos[del] - sin[w]*sin[del], z = w + del, del = 1/16 + i*1/16 box 16+i16, 17+i17 N= MRE ULP RMS ULP vector g77 375 4.08E-16 1.88 1.40E-16 0.34 normal 120 8.90E-16 3.00 2.96E-16 1.42 kahan 240 5.73E-16 2.37 1.80E-16 0.70 pfe prim 340 4.81E-16 2.12 1.49E-16 0.43 real g77 873 4.49E-16 2.01 1.42E-16 0.35 normal 388 1.24E-15 3.48 3.10E-16 1.48 kahan 676 7.23E-16 2.70 2.00E-16 0.85 pfe prim 843 5.68E-16 2.35 1.52E-16 0.45 imaginary g77 894 4.58E-16 2.05 1.41E-16 0.34 normal 458 9.03E-16 3.02 2.92E-16 1.40 kahan 671 7.61E-16 2.78 1.88E-16 0.76 pfe prim 834 5.04E-16 2.18 1.46E-16 0.40 If any of the following is not almost -134163 + i 1188, ZSIN has the wrong period: g77 -1.341634E+05 + i 1.1876E+03 normal -1.341634E+05 + i 1.187568E+03 kahan -1.341634E+05 + i 1.187568E+03 pfe prim -1.341634E+05 + i 1.187568E+03 g77 Z SIN[Z] + SIN[-Z] 3.916297E+00 + i 9.536624E+00 0.000000E+00 + i 0.000000E+00 2.076811E+00 + i 9.601154E+00 0.000000E+00 + i 0.000000E+00 1.431049E-01 + i 7.888105E+00 0.000000E+00 + i 0.000000E+00 6.012109E+00 + i 1.512857E+00 0.000000E+00 + i 0.000000E+00 9.106898E+00 + i 8.361118E+00 0.000000E+00 + i 0.000000E+00 normal Z SIN[Z] + SIN[-Z] 3.916297E+00 + i 9.536624E+00 0.000000E+00 + i 0.000000E+00 2.076811E+00 + i 9.601154E+00 0.000000E+00 + i 0.000000E+00 1.431049E-01 + i 7.888105E+00 0.000000E+00 + i 0.000000E+00 6.012109E+00 + i 1.512857E+00 0.000000E+00 + i 0.000000E+00 9.106898E+00 + i 8.361118E+00 0.000000E+00 + i 0.000000E+00 kahan Z SIN[Z] + SIN[-Z] 3.916297E+00 + i 9.536624E+00 0.000000E+00 + i 0.000000E+00 2.076811E+00 + i 9.601154E+00 0.000000E+00 + i 0.000000E+00 1.431049E-01 + i 7.888105E+00 0.000000E+00 + i 0.000000E+00 6.012109E+00 + i 1.512857E+00 0.000000E+00 + i 0.000000E+00 9.106898E+00 + i 8.361118E+00 0.000000E+00 + i 0.000000E+00 pfe prim Z SIN[Z] + SIN[-Z] 3.916297E+00 + i 9.536624E+00 0.000000E+00 + i 0.000000E+00 2.076811E+00 + i 9.601154E+00 0.000000E+00 + i 0.000000E+00 1.431049E-01 + i 7.888105E+00 0.000000E+00 + i 0.000000E+00 6.012109E+00 + i 1.512857E+00 0.000000E+00 + i 0.000000E+00 9.106898E+00 + i 8.361118E+00 0.000000E+00 + i 0.000000E+00 Test the significance in the real or imaginary components near the zeros of the real sin or cos: All of the following have an estimated loss 0.00 of base 2 digits in the imaginary part for SIN[ 1.100000E+01 + i 1.250000E+01 ]: g77 -1.341673E+05 + i 5.937899E+02 normal -1.341673E+05 + i 5.937899E+02 kahan -1.341673E+05 + i 5.937899E+02 pfe prim -1.341673E+05 + i 5.937899E+02 All of the following have an estimated loss 0.00 of base 2 digits in the real part for SIN[ 2.200000E+01 + i 1.250000E+01 ]: g77 -1.187568E+03 - i 1.341634E+05 normal -1.187568E+03 - i 1.341634E+05 kahan -1.187568E+03 - i 1.341634E+05 pfe prim -1.187568E+03 - i 1.341634E+05 Test of error returns. The first two of these should not trigger an error message, but the third should: SIN[ 1.000E+00 + i 7.093E+02 ] = g77 4.588E+307 + i 2.946E+307 normal 4.588E+307 + i 2.946E+307 kahan 4.588E+307 + i 2.946E+307 pfe prim 4.588E+307 + i 2.946E+307 SIN[ 9.007E+15 + i 1.000E+00 ] = g77 -1.310E+00 - i 6.211E-01 normal -1.310E+00 - i 6.211E-01 kahan -1.310E+00 - i 6.211E-01 pfe prim -1.310E+00 - i 6.211E-01 SIN[ 1.000E+00 + i 9.007E+15 ] = g77 INF + i INF normal INF + i INF kahan INF + i INF pfe prim INF + i INF