CSE_321_4_5
CSE_321_4_5
Chapter -4
(Continuation)
4.8 Floating Point
• Real numbers:
• 3.14159265…. ()
• 2.71828… (e)
• 0.000000001 or 1.0 × 10-9 (seconds in a
nanosecond)
• 3,155,760,000 or 3.15576 × 109 (seconds in a
century)
• Scientific Notation
4.8 Floating Point
• Normalized numbers:
• A number in scientific notation that has no
leading zeros.
• 1.0 × 10-9
×
• 0.1 × 10-8
• 10.0 × 10-10
4.8 Floating Point
• 1.0 × 2-1
Binary Point
• 1. xxxxxxxx × 2yyyy
• Computer arithmetic that support such numbers is
called floating point because it represents numbers in
which the binary point is not fixed.
4.8 Floating Point
• (-1)S × F × 2E
• As small as 2.0ten × 10 -308
• As large as 2.0ten × 10 308
Floating Point Representation
• Double precision
• IEEE 754
• (-1)S × (1 + Significand) × 2E
• (-1)S × (1 + (s1 × 2-1) + (s2 × 2-2) + … … ) × 2E
3130292827262524232221201918171615141312 11 10 9 8 7 6 5 4 3 2 1 0
s exponent significand
1 bit 11 bits 20 bits
3130292827262524232221201918171615141312 11 10 9 8 7 6 5 4 3 2 1 0
Significand (Continued)
32 bits
Floating Point Representation
• When we want to represent zero (0)
• (-1)S × (1 + Significand) × 2E
• (-1)S × (1 + (s1 × 2-1) + (s2 × 2-2) + … … ) × 2E
31 3029 2827 2625 2423 2221 2019 1817 16151413 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
• 1+0=1
Floating Point Representation
• Biased Notation
• A = 1.0 × 2-1, B = 1.0 × 2+1, Whether A>B or not
• 1.0 × 2-1
31 3029 2827 2625 2423 2221 2019 1817 16151413 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
• 1.0 × 2+1
31 3029 2827 2625 2423 2221 2019 1817 16151413 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
• -1 -1 + 127 = 126
• +1 +1 + 127 = 128
• (-1)S × (1 + Significand) × 2(Exponent – Bias)
• For Double Precision bias is 1023