Académique Documents
Professionnel Documents
Culture Documents
β base or radix
p precision
[L, U ] exponent range
Number x represented as
!
d d dp−1
x = ± d0 + 1 + 22 + · · · + p−1 β E ,
β β β
where
0 ≤ di ≤ β − 1, i = 0, . . . , p − 1, and L ≤ E ≤ U
E called exponent
system β p L U
IEEE SP 2 24 −126 127
IEEE DP 2 53 −1022 1023
Cray 2 48 −16383 16384
HP calculator 10 12 −499 499
IBM mainframe 16 6 −64 63
25
Normalization
1≤m<β
26
Properties of Floating-Point Systems
................................................................................................................................................................................................................................................................................
−4 −3 −2 −1 0 1 2 3 4
28
Rounding Rules
30
Machine Precision, continued
................................................................................................................................................................................................................................................................................
−4 −3 −2 −1 0 1 2 3 4
32
Exceptional Values
33
Floating-Point Arithmetic
34
Example: Floating-Point Arithmetic
Assume β = 10, p = 6
x + y = 1.93039 × 102,
assuming rounding to nearest
x ∗ y = 1.22326 × 102,
which discards half of digits of true product
35
Floating-Point Arithmetic, continued
36
Example: Summing a Series
Infinite series
∞
X 1
n=1 n
has finite sum in floating-point arithmetic even
though real series is divergent
Possible explanations:
37
Floating-Point Arithmetic, continued
(1 + ) + = 1, but 1 + ( + ) > 1
38
Cancellation
Example:
39
Cancellation, continued
(1 + ) − (1 − ) = 1 − 1 = 0
in floating-point arithmetic, which is correct
for actual operands of final subtraction, but
true result of overall computation, 2, has been
completely lost
41
Example: Cancellation
42
Example: Quadratic Formula
45
Desirable Qualities of Math Software
• Reliability
• Robustness
• Accuracy
• Efficiency
• Maintainability
• Portability
• Usability
• Applicability
46
Sources of Math Software
• sophisticated graphics
48