# [R] Precision in R

Francisco J. Zagmutt gerifalte28 at hotmail.com
Fri May 6 00:56:33 CEST 2005

```Did you try format(x,digits=22).  22 digits is the maximum supported.

I hope this helps

Francisco

>From: "Huntsinger, Reid" <reid_huntsinger at merck.com>
>To: "'Francisco Fuentes'" <franciscofuentes2005 at yahoo.co.uk>,
>r-help at stat.math.ethz.ch
>Subject: RE: [R] Precision in R
>Date: Thu, 5 May 2005 14:18:50 -0400
>
>The summands can get pretty large: the 2^(2*r) factor will erase a lot of
>precision. Is there another way to compute this? Perhaps use the recurrence
>relation for the binomial coefficient to get a recurrence relation for your
>function?
>
>Reid Huntsinger
>
>-----Original Message-----
>From: r-help-bounces at stat.math.ethz.ch
>[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Francisco Fuentes
>Sent: Thursday, May 05, 2005 2:02 PM
>To: r-help at stat.math.ethz.ch
>Subject: [R] Precision in R
>
>
>Could anyone help me with the following issue.
>Using the GSL library in R I define the following code:
>
>#########
>library(gsl);
>S<-function(n)
>{ r<-0:n;
>ans<-sum(gsl_sf_choose(n,r)*(-1)^r*2^(2*r)*gamma_inc(6-2*r,2))
>ans }
>#########
> >SS(10)   yields 34.91868
> >SS(40)   yields 5.340422
> >SS(60)   yields 180.3162
>Doing the same computations in maple I get
>
>34.918679360927169740821310620770402166885975646756
>5.340473872869891061658721253647686930049562214921
>2.2269219454888559341895277572725106
>
>respectively.  Is this a precision problem?
>
>
>
>---------------------------------
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>http://www.R-project.org/posting-guide.html
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>http://www.R-project.org/posting-guide.html

```