looking for floating-point test software

David Wuertele dave-gnus@bfnet.com
Wed Oct 20 21:02:00 GMT 2004


Andreas> Paranoia? E.g. http://www.netlib.org/paranoia/ ?

Wow, that was pretty revealing.  Not in a good way.  Here's the test
results I got from paranoia running on my mipsel running linux-2.4.18,
compiled with gcc-3.3.3, binutils-2.14, and glibc-2.3.2.  What REALLY
suprised me was that emulation and soft-float had completely and
exactly identical errors!  Here's what the output looks like from
either of them.  Any comments on this, and should I be filing bugs
about this somewhere?

# /usr/local/bin/paranoia
Lest this program stop prematurely, i.e. before displaying

    `END OF TEST',

try to persuade the computer NOT to terminate execution when an
error like Over/Underflow or Division by Zero occurs, but rather
to persevere with a surrogate value after, perhaps, displaying some
warning.  If persuasion avails naught, don't despair but run this
program anyway to see how many milestones it passes, and then
amend it to make further progress.

Answer questions with Y, y, N or n (unless otherwise indicated).


To continue, press RETURN

Diagnosis resumes after milestone Number 0          Page: 1

Users are invited to help debug and augment this program so it will
cope with unanticipated and newly uncovered arithmetic pathologies.

Please send suggestions and interesting results to
	Richard Karpinski
	Computer Center U-76
	University of California
	San Francisco, CA 94143-0704, USA

In doing so, please include the following information:
	Precision:	double;
	Version:	10 February 1989;
	Computer:

	Compiler:

	Optimization level:

	Other relevant compiler options:

To continue, press RETURN

Diagnosis resumes after milestone Number 1          Page: 2

Running this program should reveal these characteristics:
     Radix = 1, 2, 4, 8, 10, 16, 100, 256 ...
     Precision = number of significant digits carried.
     U2 = Radix/Radix^Precision = One Ulp
	(OneUlpnit in the Last Place) of 1.000xxx .
     U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 .
     Adequacy of guard digits for Mult., Div. and Subt.
     Whether arithmetic is chopped, correctly rounded, or something else
	for Mult., Div., Add/Subt. and Sqrt.
     Whether a Sticky Bit used correctly for rounding.
     UnderflowThreshold = an underflow threshold.
     E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy.
     V = an overflow threshold, roughly.
     V0  tells, roughly, whether  Infinity  is represented.
     Comparisions are checked for consistency with subtraction
	and for contamination with pseudo-zeros.
     Sqrt is tested.  Y^X is not tested.
     Extra-precise subexpressions are revealed but NOT YET tested.
     Decimal-Binary conversion is NOT YET tested for accuracy.

To continue, press RETURN

Diagnosis resumes after milestone Number 2          Page: 3

The program attempts to discriminate among
   FLAWs, like lack of a sticky bit,
   Serious DEFECTs, like lack of a guard digit, and
   FAILUREs, like 2+2 == 5 .
Failures may confound subsequent diagnoses.

The diagnostic capabilities of this program go beyond an earlier
program called `MACHAR', which can be found at the end of the
book  `Software Manual for the Elementary Functions' (1980) by
W. J. Cody and W. Waite. Although both programs try to discover
the Radix, Precision and range (over/underflow thresholds)
of the arithmetic, this program tries to cope with a wider variety
of pathologies, and to say how well the arithmetic is implemented.

The program is based upon a conventional radix representation for
floating-point numbers, but also allows logarithmic encoding
as used by certain early WANG machines.

BASIC version of this program (C) 1983 by Prof. W. M. Kahan;
see source comments for more history.

To continue, press RETURN

Diagnosis resumes after milestone Number 3          Page: 4

Program is now RUNNING tests on small integers:
FAILURE:  -1+1 != 0, (-1)+abs(1) != 0, or -1+(-1)*(-1) != 0.
Searching for Radix and Precision.
Radix = nan .
Closest relative separation found is U1 = nan .

Recalculating radix and precision
 gets better closest relative separation U1 = -1.1102236e-16 .
MYSTERY: recalculated Radix = -1.1102236e-16 .
FLAW:  Radix is not as good as 2 or 10.
FAILURE:  (1-U1)-1/2 < 1/2 is FALSE, prog. fails?.
The number of significant digits of the Radix is -0.000000 .
SERIOUS DEFECT:  Disagreements among the values X1, Y1, Z1,
respectively  1.1102230e-16,  0.0000000e+00,  1.1102236e-16,
are symptoms of inconsistencies introduced
by extra-precise evaluation of arithmetic subexpressions.
Possibly some part of this test appears to be inconsistent...
   PLEASE NOTIFY KARPINKSI!

To continue, press RETURN

Diagnosis resumes after milestone Number 30          Page: 5


Checking for guard digit in *, /, and -.
SERIOUS DEFECT:  * lacks a Guard Digit, so 1*X != X.
FAILURE:  * gets too many final digits wrong.
.
SERIOUS DEFECT:  - lacks Guard Digit, so cancellation is obscured.

To continue, press RETURN

Diagnosis resumes after milestone Number 40          Page: 6

Checking rounding on multiply, divide and add/subtract.
Multiplication appears to round correctly.
Multiplication test appears to be inconsistent...
   PLEASE NOTIFY KARPINKSI!
/ is neither chopped nor correctly rounded.
FAILURE:  Incomplete carry-propagation in Addition.
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.

Running test of square root(x).
FAILURE:  Square root of 0.0, -0.0 or 1.0 wrong.
SERIOUS DEFECT:  
sqrt( 1.23259633990246148e-32) - -1.11022355402074833e-16  = 2.22044604925031308e-16
	instead of correct value 0 .
SERIOUS DEFECT:  
sqrt( 8.11295610434096026e+31) - -9.00719495977574600e+15  = 9.00719925474099200e+15
	instead of correct value 0 .
SERIOUS DEFECT:  
sqrt( 1.23259633990246148e-32) - -1.11022355402074833e-16  = 2.22044604925031308e-16
	instead of correct value 0 .

To continue, press RETURN

Diagnosis resumes after milestone Number 70          Page: 7

Test for sqrt monotonicity.
sqrt has passed a test for Monotonicity.
Testing whether sqrt is rounded or chopped.
FAILURE:  Anomalous arithmetic with Integer < Radix^Precision = -9.0071950e+15
 fails test whether sqrt rounds or chops.
Square root is neither chopped nor correctly rounded.
Observed errors run from -4.5035996e+15 to 1.8014381e+16 ulps.
SERIOUS DEFECT:  sqrt gets too many last digits wrong.

To continue, press RETURN

Diagnosis resumes after milestone Number 90          Page: 8

Testing powers Z^i for small Integers Z and i.
WARNING:  computing
	(-0.00000000000000000e+00) ^ (0.00000000000000000e+00)
	yielded 2.12199579145933796e-314;
	which compared unequal to correct 1.00000000000000000e+00 ;
		they differ by -1.00000000000000000e+00 .
Similar discrepancies have occurred 4 times.
DEFECT:  computing
	(1.00000000000000000e+01) ^ (1.00000000000000000e+00)
	yielded 4.94065645841246544e-324;
	which compared unequal to correct 1.00000000000000000e+01 ;
		they differ by -1.00000000000000000e+01 .
Errors like this may invalidate financial calculations
	involving interest rates.
Similar discrepancies have occurred 13 times.

To continue, press RETURN

Diagnosis resumes after milestone Number 100          Page: 9

Seeking Underflow thresholds UfThold and E0.
DEFECT:  Difference underflows at a higher threshold than products.
Smallest strictly positive number found is E0 = 4.94066e-324 .
Since comparison denies Z = 0, evaluating (Z + Z) / Z should be safe.
What the machine gets for (Z + Z) / Z is  2.00000000000000000e+00 .
This is a DEFECT!

To continue, press RETURN

Diagnosis resumes after milestone Number 120          Page: 10

FAILURE:  Underflow confuses Comparison, which alleges that
Q == Y while denying that |Q - Y| == 0; these values
print out as Q = 1.00000000000000022e+00, Y = 1.00000000000000022e+00 .
|Q - Y| = 1.06099789498857051e-314 .

The Underflow threshold is 1.00000000000000022e+00,  below which
calculation may suffer larger Relative error than merely roundoff.
DEFECT:  Range is too narrow; U1^5 Underflows.
Since underflow occurs below the threshold
UfThold = (2.00000000000000000e+00) ^ (-1.76811396193618361e-316)
only underflow should afflict the expression
	(2.00000000000000000e+00) ^ (-3.53622792387236722e-316);
actually calculating yields: 2.12199579145933796e-314 .
SERIOUS DEFECT:  this is not between 0 and underflow
   threshold = 1.00000000000000022e+00 .

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.
DEFECT:  computing
	(1.00000000000000000e+01) ^ (-6.58271785480166346e-35)
	yielded 2.12199579145933796e-314;
	which compared unequal to correct 1.00000000000000000e+00 ;
		they differ by -1.00000000000000000e+00 .
Similar discrepancies have occurred 4 times.


To continue, press RETURN

Diagnosis resumes after milestone Number 160          Page: 11

Searching for Overflow threshold:
This may generate an error.
Can `Z = -Y' overflow?
Trying it on Y = -inf .
Seems O.K.
Overflow threshold is V  = 1.79769313486231571e+308 .
Overflow saturates at V0 = inf .
No Overflow should be signaled for V * 1 = 1.79769313486231571e+308
                           nor for V / 1 = 1.79769313486231571e+308 .
Any overflow signal separating this * from the one
above is a DEFECT.

SERIOUS DEFECT:  Comparison alleges that what prints as Z = 1.00000000000000022e+00
 is too far from sqrt(Z) ^ 2 = 0.00000000000000000e+00 .
SERIOUS DEFECT:  Comparison alleges that what prints as Z = 4.94065645841246544e-324
 is too far from sqrt(Z) ^ 2 = 0.00000000000000000e+00 .
DEFECT:  Comparison alleges that Z =     1.797693e+308
 is too far from sqrt(Z) ^ 2 (0.00000000000000000e+00) .
DEFECT:  Comparison alleges that Z =               inf
 is too far from sqrt(Z) ^ 2 (0.00000000000000000e+00) .

To continue, press RETURN

Diagnosis resumes after milestone Number 190          Page: 12

DEFECT:  Badly unbalanced range; UfThold * V = inf
	is too far from 1.


What message and/or values does Division by Zero produce?
This can interupt your program.  You can skip this part if you wish.
Do you wish to compute 1 / 0? 
O.K.

Do you wish to compute 0 / 0? 
O.K.

To continue, press RETURN

Diagnosis resumes after milestone Number 220          Page: 13


The number of  FAILUREs  encountered =       7.
The number of  SERIOUS DEFECTs  discovered = 10.
The number of  DEFECTs  discovered =         8.
The number of  FLAWs  discovered =           2.

The arithmetic diagnosed has unacceptable Serious Defects.
Potentially fatal FAILURE may have spoiled this program's subsequent diagnoses.
END OF TEST.
# 


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list