-1

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 = ? 
Paul R
  • 208,748
  • 37
  • 389
  • 560
user69514
  • 26,935
  • 59
  • 154
  • 188
  • 7
    This is clearly a homework question. Of course, it's okay to ask for help with your homework on SO but you need to show us what you've tried and specify what is causing you confusion. Using the "homework" tag would also be a good idea. – Tyler Feb 20 '10 at 04:35

2 Answers2

0

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
  • 4,586
  • 21
  • 35
0
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
  • 143,651
  • 25
  • 248
  • 329