# [R] possible to increase precision

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Oct 30 23:10:44 CET 2009

```I think he means something like packages Rmpfr and gmp provide.

However, careful numerical analysis (and working with x-1 or log(x)
for numbers very near one) means that such packages are rarely
necessary (although they can be very convenient).

It all depends on the calculations: vague questions necessitate vague

On Fri, 30 Oct 2009, Ista Zahn wrote:

> Hi Greg,
> Others on this list are much more knowledgeable than I am, and I'm
> sure they  will correct me if I'm wrong.
>
> My understanding is that R uses double precision (see
> http://en.wikipedia.org/wiki/Double_precision_floating-point_format),
> which has the following implication:
>
>> x <- c(1,2,3)/10^308
>> x*10^308
> [1] 1 2 3
>> x <- c(1,2,3)/10^309
>> x*10^309
> [1] NaN NaN NaN
>
> among others. See
>
> RSiteSearch("floating point")
>
> for other additional implications. I think you're out of luck it you
> need to work with values smaller than 1*10^308.
>
> -Ista
>
> On Fri, Oct 30, 2009 at 5:04 PM, Greg Michaelson <gmichaelson at me.com> wrote:
>> I would like to increase the precision/accuracy of R.  That is, I'm dealing
>> with numbers exceedingly close to 1, and I would like to increase the number
>> of significant digits used in computation.  In matlab, you can use vpa() to
>> accomplish this. I'm wondering if there's an equivalent or a workaround in
>> R.
>>
>> Greg
>
> --
> Ista Zahn
> University of Rochester
> Department of Clinical and Social Psychology
> http://yourpsyche.org

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
```