1

someone can explain to me what is happening?

double dbl = stdtod("9999999999999999", NULL); 

I got the value: 9999999999999998
and not: 9999999999999999

I don't understand why this happen, in the MSDN, is specified that the max double number is 1.7976931348623158E+308, so it can't be a overflow.

Thanks

GSerg
  • 76,472
  • 17
  • 159
  • 346
scifie
  • 9
  • 1
  • 2
    But it doesn't say that all the numbers in between the minimum and the max are representable. Gory details in ["What every computer scientist should know about floating-point arithmetic"](http://www.engrng.pitt.edu/hunsaker/3097/floatingpoint.pdf). – R. Martinho Fernandes Apr 13 '11 at 18:56

1 Answers1

2

Its not an overflow its an issue with how floating point works. You have a limited nubmer of significant digits that is exceeded long before you get an overflow. This has been linked hear many times but check out this

rerun
  • 25,014
  • 6
  • 48
  • 78