IEEE 754 Floating Point Worksheet: CS 35101



IEEE 754 Floating Point Worksheet: CS 35101

Thursday, March 6, 2008 (Due by Tuesday, March 11, 2008 at the start of class)

Convert the number 3.25 into the single-precision IEEE 754 FP format. Label the different “parts” of the FP format above the boxes.

3.25 = 11.01 in base 2. To normalize, put it in the form (sign) 2exponent+bias * 1.fraction = 2127-1 * 1.101. Be sure to remember that the exponent is biased! The biased exponent can be computed by adding (exponent + bias). Here we add 1 + 127 = 128.

|s |exponent |fraction |

|31 |30 |29 |

|31 |

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 | |

Give two base 2 numbers that when added will cause an overflow error in single precision.

The largest exponent is 254 (11111110). All ones indicates NaN. When the fraction is all 1’s, the value is 3.4028234 x 1038. That plus anything, or two values whose sum is larger than that would create an overflow situation.

31 |30 |29 |28 |27 |26 |25 |24 |23 |22 |21 |20 |19 |18 |17 |16 |15 |14 |13 |12 |11 |10 |9 |8 |7 |6 |5 |4 |3 |2 |1 |0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |+

31 |30 |29 |28 |27 |26 |25 |24 |23 |22 |21 |20 |19 |18 |17 |16 |15 |14 |13 |12 |11 |10 |9 |8 |7 |6 |5 |4 |3 |2 |1 |0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

= OVERFLOW

What is their base 10 (decimal) value?

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download