[R] Rmpfr question

Ulises M. Alvarez uma at fata.unam.mx
Sat Oct 16 21:34:25 CEST 2010


Hi:

I'm trying to reproduce an arbitrary precision constant from 'Why and 
How to Use Arbitrary Precision' (Ghazi et al., COMPUTING IN SCIENCE & 
ENGINEERING May/June 2010; 
http://perso.ens-lyon.fr/philippe.theveny/cise.pdf):

d = 173746a + 94228b − 78487c

where: a = sin(1022), b = log(17.1), and c = exp(0.42).

Ghazi et al. report: d = −1.341818958e−12 whit IEEE-754 quadruple 
precision (113 bits).

I have tried to reproduce such result using the Rmpfr library using:

a <- mpfr(sin(10^22), 230)
b <- mpfr(log(171/10), 230)
c <- mpfr(exp(42/100), 230)
(d <- 173746*a + 94228*b - 78487*c)

1 'mpfr' number of precision  230   bits
[1] 
2.9904079212883516447618603706359863281250000000000000000000000000000000e-11

Which does not correspond to the value reported by Ghazi et al.

Could any one give me some some hint on how to obtain a value closer to 
the one of −1.341818958e−12 please.

(Yes, I have reproduce the 'd' value from Ghazi et al. using  'gcc 
-lmpfr -lgmp' on linux boxes).

#################
Session info:
R version 2.11.1 (2010-05-31)
x86_64-apple-darwin9.8.0

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Rmpfr_0.2-3

loaded via a namespace (and not attached):
[1] tools_2.11.1

(Have also tried with R on Linux boxes without success)
-- 
Ulises M. Alvarez
http://www.fata.unam.mx/



More information about the R-help mailing list