[R] How to handle large numbers?
macrakis at alum.mit.edu
Wed Feb 11 19:31:11 CET 2009
On Wed, Feb 11, 2009 at 6:20 AM, Robin Hankin <rksh1 at cam.ac.uk> wrote:
>  NaN
>  0.000911882
Though brob is certainly useful in many cases, it can't substitute for
thinking about numeric issues (roundoff, cancellation, overflow,
underflow) in general.
> x<-40; log(exp(x)+1)-x
> x<-as.brob(40); log(exp(x)+1)-x
The correct answer is about 4e-18. Perhaps Ryacas or some other tool
gets this right, but in general I don't think it's wise to abdicate
responsibility to one's tools. Though numerical analysis is a field in
itself, I think it's worthwhile to learn the basics.
More information about the R-help