[R] Integer manipulation

Thomas Lumley tlumley at u.washington.edu
Fri Mar 21 14:58:28 CET 2003

On Fri, 21 Mar 2003, Wayne Jones wrote:

> Hi there,
> When I enter a particularly long number into R it rounds it down into
> scientific notation.
> For example,
> > 2510000002679
> [1] 2.51e+12
> How can I preserve the precision of the original number?

It has been preserved:
> a<-2510000002679
> 2510000000000-a
[1] -2679

For numbers above 2^31 (or whatever .Machine$integer.max is), you have to
use floating point, which gives you about 15 digits accuracy.

If you want to print a number to more digits than the default, use the
digits= option to print(), or change options(digits)


More information about the R-help mailing list