|
|
1.1 ! root 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.3877788e-17 . ! 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 56.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 used incorrectly or not at all. ! 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 is neither chopped nor correctly rounded. ! 120: Observed errors run from 0.0000000e+00 to 5.0000000e-01 ulps. ! 121: ! 122: Diagnosis resumes after milestone Number 90 Page: 7 ! 123: ! 124: Testing powers Z^i for small Integers Z and i. ! 125: ... no discrepancis found. ! 126: ! 127: Seeking Underflow thresholds UfThold and E0. ! 128: Smallest strictly positive number found is E0 = 2.93874e-39 . ! 129: Since comparison denies Z = 0, evaluating (Z + Z) / Z should be safe. ! 130: What the machine gets for (Z + Z) / Z is 2.00000000000000000e+00 . ! 131: This is O.K., provided Over/Underflow has NOT just been signaled. ! 132: ! 133: Diagnosis resumes after milestone Number 120 Page: 8 ! 134: ! 135: ! 136: FLAW: X = 4.04076183095161331e-39 ! 137: is not equal to Z = 2.93873587705571877e-39 . ! 138: yet X - Z yields 0.00000000000000000e+00 . ! 139: Should this NOT signal Underflow, this is a SERIOUS DEFECT ! 140: that causes confusion when innocent statements like ! 141: if (X == Z) ... else ... (f(X) - f(Z)) / (X - Z) ... ! 142: encounter Division by Zero although actually ! 143: X / Z = 1 + 0.375 . ! 144: The Underflow threshold is 2.93873587705571877e-39, below which ! 145: calculation may suffer larger Relative error than merely roundoff. ! 146: SERIOUS DEFECT: Range is too narrow; U1^4 Underflows. ! 147: Since underflow occurs below the threshold ! 148: UfThold = (2.00000000000000000e+00) ^ (-1.28000000000000000e+02) ! 149: only underflow should afflict the expression ! 150: (2.00000000000000000e+00) ^ (-1.28000000000000000e+02); ! 151: actually calculating yields: 0.00000000000000000e+00 . ! 152: This computed value is O.K. ! 153: ! 154: Testing X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065007e+00 as X -> 1. ! 155: Accuracy seems adequate. ! 156: Testing powers Z^Q at four nearly extreme values. ! 157: ... no discrepancies found. ! 158: ! 159: ! 160: Diagnosis resumes after milestone Number 160 Page: 9 ! 161: ! 162: Searching for Overflow threshold: ! 163: This may generate an error. ! 164: ! 165: * * * FLOATING-POINT ERROR * * * ! 166: Can `Z = -Y' overflow? ! 167: Trying it on Y = -8.50705917302346159e+37 . ! 168: Seems O.K. ! 169: Overflow threshold is V = 1.70141183460469229e+38 . ! 170: There is no saturation value because the system traps on overflow. ! 171: No Overflow should be signaled for V * 1 = 1.70141183460469229e+38 ! 172: nor for V / 1 = 1.70141183460469229e+38 . ! 173: Any overflow signal separating this * from the one ! 174: above is a DEFECT. ! 175: ! 176: ! 177: Diagnosis resumes after milestone Number 190 Page: 10 ! 178: ! 179: ! 180: What message and/or values does Division by Zero produce? ! 181: Trying to compute 1 / 0 produces ... ! 182: * * * FLOATING-POINT ERROR * * * ! 183: ! 184: Trying to compute 0 / 0 produces ... ! 185: * * * FLOATING-POINT ERROR * * * ! 186: ! 187: Diagnosis resumes after milestone Number 220 Page: 11 ! 188: ! 189: ! 190: The number of SERIOUS DEFECTs discovered = 1. ! 191: The number of FLAWs discovered = 1. ! 192: ! 193: The arithmetic diagnosed has unacceptable Serious Defects. ! 194: ! 195: A total of 3 floating point exceptions were registered. ! 196: END OF TEST.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.