
Qiao S.Principles of floating point computation
.pdfCAS727, S. Qiao |
Part 1 Page 21 |
•Searching for overflow threshold V, roughly. It is related to emax. Overflow satuates at V0 which tells whether Infinity is represented.
•What message and/or values does division by zero (0/1, 1/0) produce? These parameters reflect whether NaN and ∞ are correctly represented.
The program paranoia also tests some elementary functions.
•Does subtraction appear to be normalized?
•Does multiplication commute?
•Testing SQRT(X).
•Testing power Zi for small integers Z and i.
X +1
• Testing power X X −1 vs. exp(2) = 7.38905609893065218 as X −→ 1.
• Testing power ZQ at four nearly extremely values.
LAPACK (see [1]) contains a routine xLAMCH for determining machine parameters.
Tables 7 and 8 show two sample runs of paranoia.c.
Note: When we ran paranoia.c on PC, the PC hung after testing of “powers ZQ at four nearly extreme values”. So we used “No Answer” to fill the subsequent testing items.
10 Fallacies
Some misconceptions still believed by many are listed here.
1.Arithmetic should be barely more precise than the data and the desired results.
2.Cancellation in the subtraction of two nearly equal numbers always causes numerical inaccuracy, or is the only cause of it.
3.Accuracy < precision for all floating-point computations.
4.Rounding errors can overwhelm a computation only if vast numbers of them accumulate.
CAS727, S. Qiao |
Part 1 Page 22 |
|
PC |
SUN |
|
|
|
Processor |
Intel Pentium 166 |
Sparc Version 8-170 |
OS |
Window 95 |
SUN Solaris 2.0 |
|
|
|
Compiler |
Turbo c/c++ 3.0 |
Workshop C v.4.0 |
Radix |
2.000000 |
2.000000 |
Closest relative |
1.1102230e − 16 |
1.1102230e − 16 |
separation (U1) |
||
The number of significant |
|
|
digits of radix |
53.000000 |
53.000000 |
Does arithmetic round on |
|
|
+, −, ×, / correct? |
Fail |
Pass |
Adequacy of guard digits |
|
|
for +, −, ×, /? |
Fail |
Pass |
Is sticky bit used |
|
|
correctly for rounding? |
Fail |
Pass |
Underflow threshold |
2.2250739e − 308 |
2.2250739e − 308 |
E0 |
4.94066e − 324 |
4.94066e − 324 |
Overflow threshold V |
No Answer |
1.79769313e + 308 |
V0 |
No Answer |
Infinity |
|
|
|
0/0 |
No Answer |
NaN |
|
|
|
1/0 |
No Answer |
Infinity |
|
|
|
Table 7: Machine Parameters
|
PC |
SUN |
|
|
|
Does subtraction appear to be normalized? |
Pass |
Pass |
|
|
|
Does multiplication commute? |
Pass |
Pass |
Testing SQRT(X) |
Fail |
Pass |
|
|
|
Testing power Zi for small integers Z and i |
Pass |
Pass |
Testing power ZQ at four nearly extremely values |
No Answer |
Pass |
X +1 |
|
|
Testing power X X −1 vs. |
|
|
exp(2) = 7.38905609893065218 as X −→ 1 |
No Answer |
Pass |
Table 8: Elementary Functions
CAS727, S. Qiao |
Part 1 Page 23 |
5.Increasing the precision at which a computation is performed increases the accuracy of the answer.
6.Rounding error can only hinder, not help, the success of a computation.
References
[1]E. Anderson, Z. Bai, C.H. Bischof, J.W. Demmel, J.J. Dongarra, J.J. Du Croz, A. Greenbaum, S.J. Hammarling, A. Mckenney, S. Ostrouchov and D.C. Sorensen. LAPACK USER’S GUIDE RELEASE 2.0, 2 ed.. Society for Industrial and Applied Mathematics, Philadelphia, PA. USA, 1995. xix+325pp.
[2]David Gay and B. A. Wichmann. A C version of Kahan’s Floating Point Test “Paranoia”,1985. URL=http://www.netlib.org/paranoia
[3]Goldberg, D.. Computer arithmetic, Appendix A of Computer Architecture: A Quantitative Approach, 2 ed., J.L. Hennessy and D.A. Patterson, Morgan Kaufmann Publishers, San Francisco.
[4]David Goldberg. What Every Computer Scientist Should Know About Floating-Point Arithmetic, ACM Computing Surveys, 23(1):5-48, 1991.
[5]IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Standard 754 - 1985. Institute of Electrical and Electronics Engineers, New York, 1985. Reprinted in SIGPLAN Notices, 22(2):9-25, 1987.
[6]W. Kahan. Lecture Notes on the Status of IEEE Standard 754 of Binary Floating-Point Arithmetic, 1996. URL=http://www.cs.berkeley.edu/ wkahan/ieee754status/
[7]W. Kahan and Joseph D. Darcy. How Java’s Floating-Point Hurts Everyone Everywhere, 1998. URL=http://www.cs.berkeley.edu/ wkahan/JAVAhurt.pdf
[8]Wilkinson J.H. Rounding errors in algebraic processes. Englewood Cli s, N.J.: Prentice Hall, 1963.