Floating point computer - Trouble with getting back correct results

Posted by Francisco P. on Stack Overflow See other posts from Stack Overflow or by Francisco P.
Published on 2011-01-17T15:46:14Z Indexed on 2011/01/17 16:54 UTC
Read the original article Hit count: 162

Filed under:
|

Having trouble with a challenge.

Let's say I have a theoretical, base 10, floating point calculator with the following characteristics

  • Only 3 digits for mantissa
  • 1 digit for exponent
  • Sign for mantissa and exponent

How would this machine compute the following?

300 + \sum_{i=1}^{100} 0.2

The correct result is 320. The machine's result is 300. But why? Can't get where the 20 goes goes missing...

Thanks for your time.

© Stack Overflow or respective owner

Related posts about floating-point

Related posts about theory