ANS FORTH CELEFUNT TEST RESULTS FOR ZSQRT(Z) zsqrt.fs vs. 0.9.3 dnw 17Jan05 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 ZSQRT. 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. We don't know whether the pfe results in the first box below, compared to the high-level Kahan results, are actually a degradation, because we don't know that anything is reliable beyond 0.5 ulp. The pfe results are clearly better at the extreme large argument. z vs. sqrt(z*z), box 0+i0, 10+i10 N= MRE ULP RMS ULP vector g77 1921 1.56e-16 0.49 2.64e-17 0.00 normal 1921 1.56e-16 0.49 2.64e-17 0.00 kahan 2000 0.00e+00 0.00 0.00e+00 0.00 pfe prim 1995 1.29E-16 0.22 6.20e-18 0.00 real g77 1921 2.17e-16 0.96 2.72e-17 0.00 normal 1922 2.17e-16 0.96 2.71e-17 0.00 kahan 2000 0.00e+00 0.00 0.00e+00 0.00 pfe prim 1995 1.33e-16 0.26 5.96e-18 0.00 imaginary g77 1921 2.01e-16 0.86 2.77e-17 0.00 normal 1921 6.62e-14 9.22 1.48e-15 3.74 kahan 2000 0.00e+00 0.00 0.00e+00 0.00 pfe prim 1995 1.47e-16 0.40 6.64e-18 0.00 z vs. -sqrt(z*z), box 0+i0, -100+i100 N= MRE ULP RMS ULP vector g77 1939 1.57e-16 0.50 2.38e-17 0.00 normal 1936 1.57e-16 0.50 2.43e-17 0.00 kahan 2000 0.00e+00 0.00 0.00e+00 0.00 pfe prim 2000 0.00e+00 0.00 0.00e+00 0.00 real g77 1939 2.22e-16 1.00 2.44e-17 0.00 normal 1937 2.22e-16 1.00 2.50e-17 0.00 kahan 2000 0.00e+00 0.00 0.00e+00 0.00 pfe prim 2000 0.00e+00 0.00 0.00e+00 0.00 imaginary g77 1939 2.10e-16 0.92 2.49e-17 0.00 normal 1936 4.74e-14 8.74 1.06e-15 3.26 kahan 2000 0.00e+00 0.00 0.00e+00 0.00 pfe prim 2000 0.00e+00 0.00 0.00e+00 0.00 SQRT[ 1.0+i0.0 ] = g77 1.000000e+00 + i 0.000000e+00 normal 1.000000e+00 + i 0.000000e+00 kahan 1.000000e+00 + i 0.000000e+00 pfe prim 1.000000e+00 + i 0.000000e+00 SQRT[ XMIN + i*XMIN ] = SQRT[ 2.225074e-308 + i 2.225074e-308 ] = g77 1.638872e-154 + i 6.788430e-155 normal 1.638872e-154 + i 6.788430e-155 kahan 1.638872e-154 + i 6.788430e-155 pfe prim 1.638872E-154 + i 6.788430E-155 SQRT[ XMAX + i*XMAX] = SQRT[ 1.797693e+308 + i 1.797693e+308 ] = g77 Inf + i 0.0000000e+00 normal Inf + i 0.000000e+00 kahan Inf + i 0.000000e+00 pfe prim 1.473095e+154 + i 6.101757e+153