Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Let a = 1.0 × 29, b = 1.0 × 29 and c = 1.0 × 21. Using the floating-point model

ID: 3888131 • Letter: L

Question

Let a = 1.0 × 29, b = 1.0 × 29 and c = 1.0 × 21. Using the floating-point model described in the text (the representation uses a 14-bit format, 5 bits for the exponent with a bias of 15, a normalized mantissa of 8 bits, and a single sign bit for the number), perform the following calculations, paying close attention to the order of operations. What can you say about the algebraic properties of floating-point arithmetic in our finite model? Do you think this algebraic anomaly holds under multiplication as well as addition?

b + (a + c) =

(b + a) + c =

Explanation / Answer

a = 1.0 x 29 = 29.0
b = -1.0 x 29 = -29.0
c = 1.0 x 21 = 21

===> b + (a + c) => -29.0 + 50.0 ==> 21.0
Binary -> 01000001101010000000000000000000
Hexadecimal -> 0x41a80000

===> (b + a) + c => 0 + 21 ==> 21.0
Binary -> 01000001101010000000000000000000
Hexadecimal -> 0x41a80000