ANS FORTH CELEFUNT TEST RESULTS FOR LN(Z) zln.fs vs. 0.9.3 dnw 18Jan05 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 ZLN. 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. The 2 ulp discrepancy in the last lines of the LN(Z) + LN(1/Z) results for "kahan" and "pfe prim" was not present in older tests (the 1 ulp discrepancy in the first lines was present). It is correct that the pfe C primitive result should be the same as the high-level Kahan result, because it occurs at a point where the stronger algorithm in the C code is not exercised. After further testing, we have concluded that the discrepancy is due to the newer gcc used here. For example, it's still there when we run the old high-level code with the new pfe or Gforth. We don't know whether it's a difference in -O3 optimization or in glibc or something else. Actually, these results are mostly slightly better than those with the old gcc and f77 compilers at nonextreme points, for all four complex math implementations. At the special points they are mostly the same, except for the discrepancy mentioned above. ln(z) vs. ln(z*z)/2, box 2+i0, 10+i10 N= MRE ULP RMS ULP vector g77 1069 2.63e-16 1.24 8.01e-17 0.00 normal 1073 2.63E-16 1.24 7.91E-17 0.00 kahan 1386 2.05E-16 0.89 3.93E-17 0.00 pfe prim 1390 2.12E-16 0.93 3.79E-17 0.00 real g77 1561 2.63e-16 1.24 7.86e-17 0.00 normal 1570 2.63E-16 1.24 7.75E-17 0.00 kahan 1921 2.16E-16 0.96 3.13E-17 0.00 pfe prim 1930 2.21E-16 1.00 2.92E-17 0.00 imaginary g77 1382 3.72e-16 1.74 8.86e-17 0.00 normal 1382 3.72e-16 1.74 8.86e-17 0.00 kahan 1438 4.19e-16 1.92 8.60e-17 0.00 pfe prim 1438 4.19e-16 1.92 8.60e-17 0.00 ln(z) vs. ln(z*z)/2, box 1000-i1000, 2000-i4000 N= MRE ULP RMS ULP vector g77 1263 2.22e-16 0.99 3.86e-17 0.00 normal 1261 2.20E-16 0.99 3.83E-17 0.00 kahan 1598 2.19E-16 0.98 1.66E-17 0.00 pfe prim 1594 2.19E-16 0.98 1.80E-17 0.00 real g77 1884 2.22e-16 1.00 3.68e-17 0.00 normal 1887 2.22E-16 1.00 3.65E-17 0.00 kahan 1982 2.22E-16 1.00 1.42E-17 0.00 pfe prim 1977 2.22E-16 1.00 1.59E-17 0.00 imaginary g77 1338 2.22e-16 1.00 9.64e-17 0.00 normal 1338 2.22e-16 1.00 9.64e-17 0.00 kahan 1613 2.22e-16 1.00 7.26e-17 0.00 pfe prim 1613 2.21E-16 1.00 7.26E-17 0.00 ln(z) vs. ln(z*z)/2, box 2.2e-16-i2.2e-16, 2.5e-01-i2.5E-01 N= MRE ULP RMS ULP vector g77 1005 2.99e-16 1.43 8.36e-17 0.00 normal 995 2.99E-16 1.43 8.44E-17 0.00 kahan 1424 2.19E-16 0.98 4.45E-17 0.00 pfe prim 1427 2.19E-16 0.98 4.38E-17 0.00 real g77 1437 3.41e-16 1.62 8.27e-17 0.00 normal 1429 3.61E-16 1.70 8.39E-17 0.00 kahan 1880 2.21E-16 1.00 3.83E-17 0.00 pfe prim 1884 2.21E-16 1.00 3.74E-17 0.00 imaginary g77 1371 2.44e-16 1.13 8.82e-17 0.00 normal 1370 1.62e-13 10.51 3.75e-15 5.08 kahan 1525 2.44e-16 1.13 7.85e-17 0.00 pfe prim 1525 2.44e-16 1.13 7.85e-17 0.00 g77 Z LN[Z] + LN[1/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 LN[Z] + LN[1/Z] 3.916297e+00 + i 9.536624e+00 0.000000e+00 + i 2.220446e-16 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 LN[Z] + LN[1/Z] 3.916297e+00 + i 9.536624e+00 0.000000e+00 - i 2.220446e-16 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 -4.440892E-16 + i 0.000000E+00 pfe prim Z LN[Z] + LN[1/Z] 3.916297e+00 + i 9.536624e+00 0.000000e+00 - i 2.220446e-16 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 -4.440892E-16 + i 0.000000e+00 LN[ 1.0 + i0.0 ] = g77 0.000000e+00 + i 0.000000e+00 normal 0.000000e+00 + i 0.000000e+00 kahan 0.000000e+00 + i 0.000000e+00 pfe prim 0.000000e+00 + i 0.000000e+00 LN[ XMIN + i*XMIN ] = LN[ 2.225074e-308 + i 2.225074e-308 ] = g77 -7.080498e+02 + i 7.853982e-01 normal -7.080498e+02 + i 7.853982e-01 kahan -Inf + i 7.853982e-01 pfe prim -7.080498e+02 + i 7.853982e-01 LN[ XMAX + i*XMAX ] = LN[ 1.797693e+308 + i 1.797693e+308 ] = g77 Inf + i 7.853982e-01 normal Inf + i 7.853982e-01 kahan Inf + i 7.853982e-01 pfe prim 7.101293e+02 + i 7.853982e-01 LN[ 0.0 + i0.0 ] = g77 NAN + i 0.000000e+00 normal -Inf + i 0.000000e+00 kahan -Inf + i 0.000000e+00 pfe prim -Inf + i 0.000000e+00