[R] Precision of values > 53 bits

Stephan Mueller stephan.mueller at atsec.com
Thu Jan 10 11:58:17 CET 2013


Hi,

I am working with large numbers and identified that R looses precision
for such high numbers.

The precision is lost exactly when the number is equal or larger than 53
bits. See the following output which shows that the numbers below 53 bit
have proper precision:

> 2^53
[1] 9007199254740992
> 2^53-1
[1] 9007199254740991
> 2^53-2
[1] 9007199254740990

Now, see the numbers above 53 bit:

> 2^53
[1] 9007199254740992
> 2^53+1
[1] 9007199254740992
> 2^53+2
[1] 9007199254740994
> 2^53+3
[1] 9007199254740996
> 2^53+4
[1] 9007199254740996


Is there a solution to the problem?

Thanks a lot
Stephan




More information about the R-help mailing list