This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Kahan's Floating Point Test



Michael Price <mprice@atl.lmco.com> wrote:
> The other day I ran Kahan's Floating Point Test "Paranoia" from
http://www.netlib.org/paranoia/index.html on two different platforms. One
was Linux 2.2.14 on a Pentium III with gcc version 3.0 20010526 (prerelease)
while the other was FreeBSD 4.3-STABLE on an AMD Thunderbird with gcc
version 3.0 20010526 (prerelease).

The FreeBSD machine passed but the Linux machine didn't. A diff of the
output from each test is shown below. Is this expected behavior?

*** freebsd.out	Wed May 30 10:11:36 2001
--- linux.out	Wed May 30 10:10:08 2001
***************
*** 96,101 ****
--- 96,105 ----
   confirms closest relative separation U1 .
  Radix confirmed.
  The number of significant digits of the Radix is 53.000000 .
+ Some subexpressions appear to be calculated extra
+ precisely with about 11 extra B-digits, i.e.
+ roughly 3.31133 extra significant decimals.
+ That feature is not tested further by this program.
  
  To continue, press RETURN
  Diagnosis resumes after milestone Number 30          Page: 5
***************
*** 108,118 ****
  Diagnosis resumes after milestone Number 40          Page: 6
  
  Checking rounding on multiply, divide and add/subtract.
! Multiplication appears to round correctly.
! Division appears to round correctly.
! Addition/Subtraction appears to round correctly.
! Checking for sticky bit.
! Sticky bit apparently used correctly.
  
  Does Multiplication commute?  Testing on 20 random pairs.
       No failures found in 20 integer pairs.
--- 112,123 ----
  Diagnosis resumes after milestone Number 40          Page: 6
  
  Checking rounding on multiply, divide and add/subtract.
! * is neither chopped nor correctly rounded.
! / is neither chopped nor correctly rounded.
! Addition/Subtraction neither rounds nor chops.
! Sticky bit used incorrectly or not at all.
! FLAW:  lack(s) of guard digits or failure(s) to correctly round or chop
! (noted above) count as one flaw in the final tally below.
  
  Does Multiplication commute?  Testing on 20 random pairs.
       No failures found in 20 integer pairs.
***************
*** 122,128 ****
  Test for sqrt monotonicity.
  sqrt has passed a test for Monotonicity.
  Testing whether sqrt is rounded or chopped.
! Square root appears to be correctly rounded.
  
  To continue, press RETURN
  Diagnosis resumes after milestone Number 90          Page: 7
--- 127,134 ----
  Test for sqrt monotonicity.
  sqrt has passed a test for Monotonicity.
  Testing whether sqrt is rounded or chopped.
! Square root is neither chopped nor correctly rounded.
! Observed errors run from -5.0000000e-01 to 5.0000000e-01 ulps.
  
  To continue, press RETURN
  Diagnosis resumes after milestone Number 90          Page: 7
***************
*** 147,153 ****
  This computed value is O.K.
  
  Testing X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065218e+00 as X -> 1.
! Accuracy seems adequate.
  Testing powers Z^Q at four nearly extreme values.
   ... no discrepancies found.
  
--- 153,163 ----
  This computed value is O.K.
  
  Testing X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065218e+00 as X -> 1.
! DEFECT:  Calculated 7.38905609548934539e+00 for
! 	(1 + (-1.11022302462515654e-16) ^ (-1.80143985094819840e+16);
! 	differs from correct value by -3.44130679508225512e-09 .
! 	This much error may spoil financial
! 	calculations involving tiny interest rates.
  Testing powers Z^Q at four nearly extreme values.
   ... no discrepancies found.
  
***************
*** 183,191 ****
  Diagnosis resumes after milestone Number 220          Page: 10
  
  
  
! No failures, defects nor flaws have been discovered.
! Rounding appears to conform to the proposed IEEE standard P754,
! except for possibly Double Rounding during Gradual Underflow.
! The arithmetic diagnosed appears to be Excellent!
  END OF TEST.
--- 193,201 ----
  Diagnosis resumes after milestone Number 220          Page: 10
  
  
+ The number of  DEFECTs  discovered =         1.
+ The number of  FLAWs  discovered =           1.
  
! The arithmetic diagnosed may be Acceptable
! despite inconvenient Defects.
  END OF TEST.

-- 
Michael Price
Distributed Processing Lab; Lockheed Martin Adv. Tech. Labs
A&E 3W; 1 Federal Street; Camden, NJ 08102
856-338-4021, fax 856-338-4144  email: mprice@atl.lmco.com


Assuming that you used the same compiler options in both cases, it appears that you have run with precision mode set to 53 bits in one case, and 64 bits in the other (likely set by the run-time library), and that you have invoked different math libraries, apparently not invoking in-line sqrt() in one case.  The standard versions of Paranoia aren't totally correct for the mixed 53- and 64- bit precision case.  Many readers will claim that running in 64-bit precision mode is incorrect.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]