Skip to content

Precision of values > 53 bits

3 messages · Stephan Mueller, Duncan Murdoch, jim holtman

#
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:
[1] 9007199254740992
[1] 9007199254740991
[1] 9007199254740990

Now, see the numbers above 53 bit:
[1] 9007199254740992
[1] 9007199254740992
[1] 9007199254740994
[1] 9007199254740996
[1] 9007199254740996


Is there a solution to the problem?

Thanks a lot
Stephan
#
On 13-01-10 6:01 AM, Stephan Mueller wrote:
R has no native numeric type with more than 53 bit precision, but other 
packages have added it.  For example, the gmp package provides an 
interface to the gmp library which supports arbitrarily large integers 
and arbitary precision rationals.

Duncan Murdoch