Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

paranoia.1bk (6536B)


      1 Lest this program stop prematurely, i.e. before displaying
      2 
      3     `END OF TEST',
      4 
      5 try to persuade the computer NOT to terminate execution when an
      6 error like Over/Underflow or Division by Zero occurs, but rather
      7 to persevere with a surrogate value after, perhaps, displaying some
      8 warning.  If persuasion avails naught, don't despair but run this
      9 program anyway to see how many milestones it passes, and then
     10 amend it to make further progress.
     11 
     12 Answer questions with Y, y, N or n (unless otherwise indicated).
     13 
     14 
     15 Diagnosis resumes after milestone Number 0          Page: 1
     16 
     17 Users are invited to help debug and augment this program so it will
     18 cope with unanticipated and newly uncovered arithmetic pathologies.
     19 
     20 Please send suggestions and interesting results to
     21 	Richard Karpinski
     22 	Computer Center U-76
     23 	University of California
     24 	San Francisco, CA 94143-0704, USA
     25 
     26 In doing so, please include the following information:
     27 	Precision:	double;
     28 	Version:	10 February 1989;
     29 	Computer:
     30 
     31 	Compiler:
     32 
     33 	Optimization level:
     34 
     35 	Other relevant compiler options:
     36 
     37 Diagnosis resumes after milestone Number 1          Page: 2
     38 
     39 Running this program should reveal these characteristics:
     40      Radix = 1, 2, 4, 8, 10, 16, 100, 256 ...
     41      Precision = number of significant digits carried.
     42      U2 = Radix/Radix^Precision = One Ulp
     43 	(OneUlpnit in the Last Place) of 1.000xxx .
     44      U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 .
     45      Adequacy of guard digits for Mult., Div. and Subt.
     46      Whether arithmetic is chopped, correctly rounded, or something else
     47 	for Mult., Div., Add/Subt. and Sqrt.
     48      Whether a Sticky Bit used correctly for rounding.
     49      UnderflowThreshold = an underflow threshold.
     50      E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy.
     51      V = an overflow threshold, roughly.
     52      V0  tells, roughly, whether  Infinity  is represented.
     53      Comparisions are checked for consistency with subtraction
     54 	and for contamination with pseudo-zeros.
     55      Sqrt is tested.  Y^X is not tested.
     56      Extra-precise subexpressions are revealed but NOT YET tested.
     57      Decimal-Binary conversion is NOT YET tested for accuracy.
     58 
     59 Diagnosis resumes after milestone Number 2          Page: 3
     60 
     61 The program attempts to discriminate among
     62    FLAWs, like lack of a sticky bit,
     63    Serious DEFECTs, like lack of a guard digit, and
     64    FAILUREs, like 2+2 == 5 .
     65 Failures may confound subsequent diagnoses.
     66 
     67 The diagnostic capabilities of this program go beyond an earlier
     68 program called `MACHAR', which can be found at the end of the
     69 book  `Software Manual for the Elementary Functions' (1980) by
     70 W. J. Cody and W. Waite. Although both programs try to discover
     71 the Radix, Precision and range (over/underflow thresholds)
     72 of the arithmetic, this program tries to cope with a wider variety
     73 of pathologies, and to say how well the arithmetic is implemented.
     74 
     75 The program is based upon a conventional radix representation for
     76 floating-point numbers, but also allows logarithmic encoding
     77 as used by certain early WANG machines.
     78 
     79 BASIC version of this program (C) 1983 by Prof. W. M. Kahan;
     80 see source comments for more history.
     81 
     82 Diagnosis resumes after milestone Number 3          Page: 4
     83 
     84 Program is now RUNNING tests on small integers:
     85 -1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.
     86 
     87 Searching for Radix and Precision.
     88 Radix = 2.000000 .
     89 Closest relative separation found is U1 = 1.1102230e-16 .
     90 
     91 Recalculating radix and precision
     92  confirms closest relative separation U1 .
     93 Radix confirmed.
     94 The number of significant digits of the Radix is 53.000000 .
     95 
     96 Diagnosis resumes after milestone Number 30          Page: 5
     97 
     98 Subtraction appears to be normalized, as it should be.
     99 Checking for guard digit in *, /, and -.
    100      *, /, and - appear to have guard digits, as they should.
    101 
    102 Diagnosis resumes after milestone Number 40          Page: 6
    103 
    104 Checking rounding on multiply, divide and add/subtract.
    105 Multiplication appears to round correctly.
    106 Division appears to round correctly.
    107 Addition/Subtraction appears to round correctly.
    108 Checking for sticky bit.
    109 Sticky bit apparently used correctly.
    110 
    111 Does Multiplication commute?  Testing on 20 random pairs.
    112      No failures found in 20 integer pairs.
    113 
    114 Running test of square root(x).
    115 Testing if sqrt(X * X) == X for 20 Integers X.
    116 Test for sqrt monotonicity.
    117 sqrt has passed a test for Monotonicity.
    118 Testing whether sqrt is rounded or chopped.
    119 Square root appears to be correctly rounded.
    120 
    121 Diagnosis resumes after milestone Number 90          Page: 7
    122 
    123 Testing powers Z^i for small Integers Z and i.
    124 ... no discrepancis found.
    125 
    126 Seeking Underflow thresholds UfThold and E0.
    127 Smallest strictly positive number found is E0 = 4.94066e-324 .
    128 Since comparison denies Z = 0, evaluating (Z + Z) / Z should be safe.
    129 What the machine gets for (Z + Z) / Z is  2.00000000000000000e+00 .
    130 This is O.K., provided Over/Underflow has NOT just been signaled.
    131 Underflow is gradual; it incurs Absolute Error =
    132 (roundoff in UfThold) < E0.
    133 The Underflow threshold is 2.22507385850720188e-308,  below which
    134 calculation may suffer larger Relative error than merely roundoff.
    135 Since underflow occurs below the threshold
    136 UfThold = (2.00000000000000000e+00) ^ (-1.02200000000000000e+03)
    137 only underflow should afflict the expression
    138 	(2.00000000000000000e+00) ^ (-1.02200000000000000e+03);
    139 actually calculating yields: 0.00000000000000000e+00 .
    140 This computed value is O.K.
    141 
    142 Testing X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065218e+00 as X -> 1.
    143 Accuracy seems adequate.
    144 Testing powers Z^Q at four nearly extreme values.
    145  ... no discrepancies found.
    146 
    147 
    148 Diagnosis resumes after milestone Number 160          Page: 8
    149 
    150 Searching for Overflow threshold:
    151 This may generate an error.
    152 Can `Z = -Y' overflow?
    153 Trying it on Y = -Infinity .
    154 Seems O.K.
    155 Overflow threshold is V  = 1.79769313486231571e+308 .
    156 Overflow saturates at V0 = Infinity .
    157 No Overflow should be signaled for V * 1 = 1.79769313486231571e+308
    158                            nor for V / 1 = 1.79769313486231571e+308 .
    159 Any overflow signal separating this * from the one
    160 above is a DEFECT.
    161 
    162 
    163 Diagnosis resumes after milestone Number 190          Page: 9
    164 
    165 
    166 What message and/or values does Division by Zero produce?
    167     Trying to compute 1 / 0 produces ...  Infinity .
    168 
    169     Trying to compute 0 / 0 produces ...  NaN .
    170 
    171 Diagnosis resumes after milestone Number 220          Page: 10
    172 
    173 
    174 
    175 No failures, defects nor flaws have been discovered.
    176 Rounding appears to conform to the proposed IEEE standard P754.
    177 The arithmetic diagnosed appears to be Excellent!
    178 END OF TEST.