开发者

strtod change last digit

someone can explain to me what is happening?

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

I got the value: 999999999开发者_运维百科9999998

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜