strtod change last digit
someone can explain to me what is happening?
double dbl = stdtod("9999999999999999", NULL);
I got the value: 999999999开发者_运维百科9999998
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
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
精彩评论