[R] Newbie question on precision

Magnus Torfason zulutime.net at gmail.com
Fri Jan 8 19:29:28 CET 2010


Paul Evans wrote:
> How can I get R to change the default precision value? For example:
>> x=0.99999999999999999
>> 1-x
> [1] 0
>
> Is there a way that I can get a non-zero value using some parameter, or some package?
> many thanks.

The 'gmp' package allows calculation with arbitrary precision rationals 
(and every finite-digit decimal is a rational).

See a recent post of mine, listing some gmp examples:
http://tolstoy.newcastle.edu.au/R/e9/help/10/01/0579.html



More information about the R-help mailing list