[R] How to handle large numbers?
rksh1 at cam.ac.uk
Wed Feb 11 12:20:13 CET 2009
checkout the Brobdingnag package:
Feng Li wrote:
> Dear R,
> I have two questions:
> 1, Why both R and Matlab give 0*Inf==NaN? To my knowledge, it should be zero
> mathematically. Am I right?
> 2, I need to calculate e.g. exp(a)/(exp(b)+c), where both a and b are very
> large numbers (>>1000, e.g a=1000, b=1007, and c=5). R gives me NaN when I
> use the following command:
>  NaN
> I am pretty sure this should be close to zero. My question is whether there
> is a general way to solve this kind of question or should I do some settings
> before computing?
> Thanks in advance!
Robin K. S. Hankin
University of Cambridge
19 Silver Street
Cambridge CB3 9EP
More information about the R-help