views:

245

answers:

2

Does anybody know how to go out solving this problem?

* a = 1.0 × 2^9
* b = −1.0 × 2^9
* c = 1.0 × 2^1 

Using the floating-point (the representation uses a 14-bit format, 5 bits for the exponent with a bias of 16, a normalized mantissa of 8 bits, and a single sign bit for the number), perform the following two calculations, paying close attention to the order of operations.

* b + (a + c) = ?
* (b + a) + c = ? 
A: 

To go through this exercise, you just follow the addition steps, as explained e.g. there: http://en.wikipedia.org/wiki/Floating_point#Addition_and_subtraction

redtuna
A: 
S EEEEE MMMMMMMM
0 11001 10000000 a
1 11001 10000000 b
0 10001 10000000 c

0 11001 00000000 c, denormalized (uh oh!)

If I'm doing this right, it looks like you can't denormalize c to a's exponent, so you end up adding 1 to -1 with the same exponent, and so you end up with 0. I believe this is a lesson on the limitations of adding a small number to a large one in a floating point format.

I will leave the second problem to you...

DigitalRoss