On 13-01-10 6:01 AM, Stephan Mueller wrote:
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?
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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.