开发者

Problem with NSNumber (double values are off by 1)

开发者 https://www.devze.com 2023-01-27 17:01 出处:网络
I\'m getting the following output and I\'ve no idea why!? The resulting number is off by 1. I thought 开发者_JAVA技巧that double\'s can handle massive numbers? I\'m sure I\'m not understanding someth

I'm getting the following output and I've no idea why!? The resulting number is off by 1.

I thought 开发者_JAVA技巧that double's can handle massive numbers? I'm sure I'm not understanding something correctly! Any help would be greatly appreciated.

(gdb) print (double) [[NSNumber numberWithDouble:9606977671929857.0] doubleValue]
$13 = 9606977671929856

Many thanks!


You've exhausted the precision of the double-precision floating point type, which only has room for about 14 significant digits in decimal notation.

0

精彩评论

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