[R] problem with the precision of numbers
kayj
kjaja27 at yahoo.com
Sun Jan 24 23:24:10 CET 2010
Hi All,
I was wondering if R can deal with high precsion numbers, below is an
example that I tried on using R and Maple where I got different results. I
was not able to use the r-bc package in R, instead I used the Rmpfr
package, below are both R and Maple results
> library(Rmpfr)
>
> s<-mpfr(0,500)
> j <- mpfr(-1,500)
>
> for (i in 0:80){
+ p<-as.numeric(i)
+ c<-choose(80,i)
+ s=s+((j^i)*c*(1-(i+1)*1/200)^200)
+
+ }
> s
1 'mpfr' number of precision 500 bits
[1]
4.6484825769379918039202329231788093343835337105287241996630873753794810915791302829474613042869191092322033403649086087872119205043462728841279067042348e-6
Maple result
6.656852479*10^(-20)
why are the two results different?
I appreciate your help
--
View this message in context: http://n4.nabble.com/problem-with-the-precision-of-numbers-tp1288905p1288905.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list