[R] Problem with long number (from character to numeric class)
Petr Savicky
savicky at praha1.ff.cuni.cz
Wed Feb 9 18:50:24 CET 2011
On Wed, Feb 09, 2011 at 07:39:55AM -0800, PtitBleu wrote:
>
> Thanks for all your answers. I didn't know this limit.
>
> I finally found another way to go around this problem: luckily the 4 first
> figures are always the same for all these numbers.
> I created a new column with as.numeric(substr(df$BigNumber,5,18)).
> Numbers are now 14-figures long and it is now ok.
14 digits are OK.
The exact limit is 2^53 as may be seen from the following
diff(2^53 - 5:0)
[1] 1 1 1 1 1
diff(2^53 + 0:5)
[1] 0 2 2 0 0
Since 2^53 > 8999999999999999, even 16 digit integers may be
used, if the first digit is at most 8.
Petr Savicky.
More information about the R-help
mailing list