CSCI206 - Computer Organization & Programming Floating Point Limits zyBook: 10.9, 10.10
Review IEEE754 S Exponent Mantissa Special values, else normalized numbers Exponent Mantissa (fraction) Value +/- zero nonzero denormalized number all 1’s +/- infinity NaN (not a number)
Largest Single Precision Float 8 bit exponent (bias = 127), 23 bit fraction All 1’s in the exponent is reserved for NaN and infinity Maximum biased exponent is 1111 1110 = 254 Maximum fraction is 23 1’s
Largest Single Precision Float 1111 1110 = 254 254-127 = 127
Largest Single Precision Float Move the decimal point 23 digits to the right subtract 23 from exponent
Largest Single Precision Float Convert mantissa
Smallest Nonzero Single What we want is: But that has exponent & fraction = 0 That value is reserved for zero! Therefore, the closest we can get is: either or
Smallest Nonzero Single Normalized In this case, using a normalized number is not ideal, if we could use a denormalized number we could get a much smaller value: This is equivalent to: An extra 22 bits of precision! Denormalized
Smallest Nonzero Single The IEEE realized this and when the exponent is zero and the fraction is > 0, the value is treated as a denormalized number. The smallest nonzero normalized: The smallest nonzero denormalized: exp = 0000 0001 exp = 0000 0000 m = 0000….1
Smallest Nonzero Normalized Single biased exponent = 1 fraction = 0 0000 0001 00000000000000000000000
Smallest Nonzero Denormalized Single biased exponent = 0 fraction = 0.00000000000000000000001 0000 0000 00000000000000000000001 *Note, even though the exponent is encoded as -127, it is computed using the smallest “valid” exponent, which is -126.