CSCI206 - Computer Organization & Programming Floating Point Arithmetic 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)
Floating Point Addition Match exponents Add the significants Normalize the sum Check overflow/underflow Round Done
FP Addition Example Show the FP addition of: 0.5 + 0.4375 using 4 bits of precision
FP Addition Example Show the FP addition of: 0.5 + 0.4375
1. Match Exponents larger exponent is , rewrite shift number right, increment exponent shift number left, decrement exponent 1. Match Exponents larger exponent is , rewrite
2. Add
3. Renormalize (nothing to do in this example)
4. Check overflow/underflow (nothing to do in this example)
5. Round 6. Done (check) (nothing to do in this example) 0.5 + 0.4375 = 0.9375 6. Done (check)
Accurate Arithmetic IEEE754 guarantees accuracy within 0.5 ulp (units in last place) error is no more than ½ of least significant digit To achieve this, 3 extra bits are added to the fractional part in arithmetic, they are called: guard, round, and sticky bits (from most significant to least).
Guard, Round, Sticky Guard and round bits act like any other bit to to the right of the decimal. The sticky bit is set if any nonzero value to the right of this place has ever existed. once set, it stays set (it’s sticky)
Addition Example with GRS Use 4-bits of precision plus GRS 5. Round GRS: 111 rounds up: 1. Normalize: G GRS Nonzero value to right of round bit, so SET sticky bit 2. Add: GRS
Multiplication Similar to addition Add exponents Multiply significands Normalize Check/round Set sign