Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

paranoia.1bk (6875B)


      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 Some subexpressions appear to be calculated extra
     96 precisely with about 11 extra B-digits, i.e.
     97 roughly 3.31133 extra significant decimals.
     98 That feature is not tested further by this program.
     99 
    100 Diagnosis resumes after milestone Number 30          Page: 5
    101 
    102 Subtraction appears to be normalized, as it should be.
    103 Checking for guard digit in *, /, and -.
    104      *, /, and - appear to have guard digits, as they should.
    105 
    106 Diagnosis resumes after milestone Number 40          Page: 6
    107 
    108 Checking rounding on multiply, divide and add/subtract.
    109 * is neither chopped nor correctly rounded.
    110 / is neither chopped nor correctly rounded.
    111 Addition/Subtraction neither rounds nor chops.
    112 Sticky bit used incorrectly or not at all.
    113 FLAW:  lack(s) of guard digits or failure(s) to correctly round or chop
    114 (noted above) count as one flaw in the final tally below.
    115 
    116 Does Multiplication commute?  Testing on 20 random pairs.
    117      No failures found in 20 integer pairs.
    118 
    119 Running test of square root(x).
    120 Testing if sqrt(X * X) == X for 20 Integers X.
    121 Test for sqrt monotonicity.
    122 sqrt has passed a test for Monotonicity.
    123 Testing whether sqrt is rounded or chopped.
    124 Square root is neither chopped nor correctly rounded.
    125 Observed errors run from -5.0000000e-01 to 5.0000000e-01 ulps.
    126 
    127 Diagnosis resumes after milestone Number 90          Page: 7
    128 
    129 Testing powers Z^i for small Integers Z and i.
    130 ... no discrepancis found.
    131 
    132 Seeking Underflow thresholds UfThold and E0.
    133 Smallest strictly positive number found is E0 = 4.94066e-324 .
    134 Since comparison denies Z = 0, evaluating (Z + Z) / Z should be safe.
    135 What the machine gets for (Z + Z) / Z is  2.00000000000000000e+00 .
    136 This is O.K., provided Over/Underflow has NOT just been signaled.
    137 Underflow is gradual; it incurs Absolute Error =
    138 (roundoff in UfThold) < E0.
    139 The Underflow threshold is 2.22507385850720188e-308,  below which
    140 calculation may suffer larger Relative error than merely roundoff.
    141 Since underflow occurs below the threshold
    142 UfThold = (2.00000000000000000e+00) ^ (-1.02200000000000000e+03)
    143 only underflow should afflict the expression
    144 	(2.00000000000000000e+00) ^ (-1.02200000000000000e+03);
    145 actually calculating yields: 0.00000000000000000e+00 .
    146 This computed value is O.K.
    147 
    148 Testing X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065218e+00 as X -> 1.
    149 Accuracy seems adequate.
    150 Testing powers Z^Q at four nearly extreme values.
    151  ... no discrepancies found.
    152 
    153 
    154 Diagnosis resumes after milestone Number 160          Page: 8
    155 
    156 Searching for Overflow threshold:
    157 This may generate an error.
    158 Can `Z = -Y' overflow?
    159 Trying it on Y =              -Inf .
    160 Seems O.K.
    161 Overflow threshold is V  = 1.79769313486231571e+308 .
    162 Overflow saturates at V0 =               Inf .
    163 No Overflow should be signaled for V * 1 = 1.79769313486231571e+308
    164                            nor for V / 1 = 1.79769313486231571e+308 .
    165 Any overflow signal separating this * from the one
    166 above is a DEFECT.
    167 
    168 
    169 Diagnosis resumes after milestone Number 190          Page: 9
    170 
    171 
    172 What message and/or values does Division by Zero produce?
    173     Trying to compute 1 / 0 produces ...      Inf .
    174 
    175     Trying to compute 0 / 0 produces ...      NaN .
    176 
    177 Diagnosis resumes after milestone Number 220          Page: 10
    178 
    179 
    180 The number of  FLAWs  discovered =           1.
    181 
    182 The arithmetic diagnosed seems Satisfactory though flawed.
    183 END OF TEST.