Paranoia Results on PowerPC

Eric Norum norume at aps.anl.gov
Mon Jul 23 20:04:59 UTC 2007


Looks like this may be a compiler issue (!)


With no optimizations I see no problems:
norume at ctlstrmvid0 215> gcc /usr/local/rtems/src/4.7.1/www.rtems.org/ 
ftp/pub/rtems/4.7.1/rtems-4.7.1/testsuites/samples/paranoia/paranoia.c
norume at ctlstrmvid0 216> yes | ./a.out
a.out version 1.1 [cygnus]
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:
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 1          Page: 2

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 2          Page: 3

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 3          Page: 4

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 4          Page: 5

Program is now RUNNING tests on small integers:
-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.

Searching for Radix and Precision.
Radix = 2.000000 .
Closest relative separation found is U1 = 1.1102230e-16 .

Recalculating radix and precision
confirms closest relative separation U1 .
Radix confirmed.
The number of significant digits of the Radix is 53.000000 .

To continue, press RETURN
Diagnosis resumes after milestone Number 30          Page: 6

Subtraction appears to be normalized, as it should be.
Checking for guard digit in *, /, and -.
      *, /, and - appear to have guard digits, as they should.

To continue, press RETURN
Diagnosis resumes after milestone Number 40          Page: 7

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.

Running test of square root(x).
Testing if sqrt(X * X) == X for 20 Integers X.
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: 8

Testing powers Z^i for small Integers Z and i.
... no discrepancies found.

Seeking Underflow thresholds UfThold and E0.
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 O.K., provided Over/Underflow has NOT just been signaled.
Underflow is gradual; it incurs Absolute Error =
(roundoff in UfThold) < E0.
The Underflow threshold is 2.22507385850720188e-308,  below which
calculation may suffer larger Relative error than merely roundoff.
Since underflow occurs below the threshold
UfThold = (2.00000000000000000e+00) ^ (-1.02200000000000000e+03)
only underflow should afflict the expression
         (2.00000000000000000e+00) ^ (-2.04400000000000000e+03);
actually calculating yields: 0.00000000000000000e+00 .
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.


To continue, press RETURN
Diagnosis resumes after milestone Number 160          Page: 9

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.


To continue, press RETURN
Diagnosis resumes after milestone Number 190          Page: 10


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?     Trying to compute 1 / 0  
produces ...  inf .

Do you wish to compute 0 / 0?
     Trying to compute 0 / 0 produces ...  nan .

To continue, press RETURN
Diagnosis resumes after milestone Number 220          Page: 11



No failures, defects nor flaws have been discovered.
Rounding appears to conform to the proposed IEEE standard P754.
The arithmetic diagnosed appears to be Excellent!

A total of 2030729482 floating point exceptions were registered.
END OF TEST.
norume at ctlstrmvid0 217>




However, with -O2 optimization (sic) I get the FLAW which you reported:

norume at ctlstrmvid0 206> gcc -O2 /usr/local/rtems/src/4.7.1/ 
www.rtems.org/ftp/pub/rtems/4.7.1/rtems-4.7.1/testsuites/samples/ 
paranoia/paranoia.c
norume at ctlstrmvid0 207> ./a.out
a.out version 1.1 [cygnus]
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:
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 1          Page: 2

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 2          Page: 3

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 3          Page: 4

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 4          Page: 5

Program is now RUNNING tests on small integers:
-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.

Searching for Radix and Precision.
Radix = 2.000000 .
Closest relative separation found is U1 = 1.1102230e-16 .

Recalculating radix and precision
confirms closest relative separation U1 .
Radix confirmed.
The number of significant digits of the Radix is 53.000000 .

To continue, press RETURN

Diagnosis resumes after milestone Number 30          Page: 6

Subtraction appears to be normalized, as it should be.
Checking for guard digit in *, /, and -.
      *, /, and - appear to have guard digits, as they should.

To continue, press RETURN

Diagnosis resumes after milestone Number 40          Page: 7

Checking rounding on multiply, divide and add/subtract.
* is neither chopped nor correctly rounded.
Division appears to round correctly.
Addition/Subtraction appears to round correctly.
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).
Testing if sqrt(X * X) == X for 20 Integers X.
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: 8

Testing powers Z^i for small Integers Z and i.
... no discrepancies found.

Seeking Underflow thresholds UfThold and E0.
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 O.K., provided Over/Underflow has NOT just been signaled.
Underflow is gradual; it incurs Absolute Error =
(roundoff in UfThold) < E0.
The Underflow threshold is 2.22507385850720188e-308,  below which
calculation may suffer larger Relative error than merely roundoff.
Since underflow occurs below the threshold
UfThold = (2.00000000000000000e+00) ^ (-1.02200000000000000e+03)
only underflow should afflict the expression
         (2.00000000000000000e+00) ^ (-2.04400000000000000e+03);
actually calculating yields: 0.00000000000000000e+00 .
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.


To continue, press RETURN

Diagnosis resumes after milestone Number 160          Page: 9

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.


To continue, press RETURN

Diagnosis resumes after milestone Number 190          Page: 10


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: 11


The number of  FLAWs  discovered =           1.

The arithmetic diagnosed seems Satisfactory though flawed.
END OF TEST.
norume at ctlstrmvid0 208>
norume at ctlstrmvid0 208>







norume at ctlstrmvid0 208> uname -a
Darwin ctlstrmvid0.aps.anl.gov 8.9.0 Darwin Kernel Version 8.9.0: Thu  
Feb 22 20:54:07 PST 2007; root:xnu-792.17.14~1/RELEASE_PPC Power  
Macintosh powerpc RackMac1,2 Darwin
norume at ctlstrmvid0 209>

On Jul 23, 2007, at 2:42 PM, Joel Sherrill wrote:

> Hi,
>
> I have been running paranoia on psim and the gen5200
> BSP.  Both report the following as a minor flaw:;;;;
>
> Addition/Subtraction neither rounds nor chops.
> Sticky bit used incorrectly or not at all.
> TEST: lack(s) of guard digits or failure(s) to correctly round or chop
> (noted above) count as one flaw in the final tally below
> ERROR: Severity: 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.
> PASS: lack(s) of guard digits or failure(s) to correctly round or chop
> (noted above) count as one flaw in the final tally below
>
> Is this as good at the PowerPC gets?  Is it possible the
> FPSCR isn't initialized such that the results are better?
>
> I spotted one online result from a non-GCC compiler which
> had the same result on the PowerPC.  So I am suspicious this
> is just the way it is.
>
> Does anyone have a PowerPC system to compare against?  I
> am especially interested in results from a PowerPC Mac or
> UNIX based system.
>
> Thanks.
>
> --joel
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users

-- 
Eric Norum <norume at aps.anl.gov>
Advanced Photon Source
Argonne National Laboratory
(630) 252-4793





More information about the users mailing list