IQmath
Floating-Point Representation
IEEE Std. 754 Single Precision
IEEE Std. 754 Single Precision
Floating
Floating
-
-
Point
Point
s eeeeeeee
fffffffffffffffffffffff
031 30 23 22
23 bit mantissa (fraction)8 bit exponent
1 bit sign
Advantage
Advantage
⇒
⇒
Exponent gives large dynamic range
Exponent gives large dynamic range
Disadvantage
Disadvantage
⇒
⇒
Precision of a number depends on its exponent
Precision of a number depends on its exponent
Case 1: if e = 255 and f = 0, then v = NaN
Case 2: if e = 255 and f = 0, then v = [(-1)
s
]*infinity
Case 3:
Case 3:
if 0 < e < 255,
if 0 < e < 255,
then v = [(
then v = [(
-
-
1)
1)
s
s
]*[2
]*[2
(e
(e
-
-
127)
127)
]*(1.f)
]*(1.f)
Case 4:
Case 4:
if e = 0 and f = 0,
if e = 0 and f = 0,
then v = [(
then v = [(
-
-
1)
1)
s
s
]*[2
]*[2
(
(
-
-
126)
126)
]*(0.f)
]*(0.f)
Case 5: if e = 0 and f = 0, then v = [(-1)
s
]*0
/
/
/
Floating
Floating
-
-
Point does not Solve
Point does not Solve
Everything!
Everything!
Example: x = 10.0 (0x41200000)
+ y = 0.000000238 (0x347F8CF1)
z = 10.000000238
RIGHT?WRONG!
You cannot represent 10.000000238 with
single-precision floating point
0x412000000 = 10.000000000
10.000000238 ⇐ can’t represent!
0x412000001 = 10.000000950
So z gets rounded down to 10.000000000
8 - 14 C28x - Numerical Concepts & IQmath