[R] (arbitrary) precision

Michael Grottke Michael.Grottke at duke.edu
Fri Feb 18 02:32:03 CET 2005


Hello,

I am currently using R for fitting a model to various data sets 
(minimizing the negative log-likelihood) and calculating a number of 
metrics based on the parameter estimates. Within these calculations, I 
have steps of the form

log(log(1+x)),

where x can be very small (e.g., around 1e-16). Unfortunately, the 
precision of doubles does not suffice for coping with the difference in 
the orders of magnitude of 1 and x: 1+x is rounded to 1.

One way for solving this problem seems to be to use an arbitrary 
precision library implemented in C and call the respective routines for 
calculating the logarithm(s) from within R.

My questions are as follows:
1. Is there any better/more direct way to solve the problem?
2. Is there any arbitrary precision library you can suggest in particular?

Thanks a lot for your help.

Best regards,
   Michael

-- 
-------------------------------------------------
Dr. Michael Grottke
Department of Electrical and Computer Engineering
Box 90291
Duke University
Durham, NC 27708-0291, USA

Phone:  ++1 (919) 660-5051
E-mail: Michael.Grottke at duke.edu




More information about the R-help mailing list