[R] big numbers
Robin Hankin
r.hankin at noc.soton.ac.uk
Tue Aug 22 12:47:26 CEST 2006
Hi
Can I get R to handle really big numbers? I am not interested
in more than (say) 10 sig figs, but I would like to deal with numbers
up to, say, 10^10000.
If
a <- 10^10000
b <- pi* a
I would like "a+b" to return 3.1415926e10000.
Toy example, illustrating why I can't deal with log(a) and log(b),
follows.
f <- function(a,n=100){
out <- rep(0,n)
out[1] <- a
for(i in 2:n){
out[i] <- sum(exp(out[1:i])) + rexp(1)
}
return(log(out))
}
then f(1,10) has infinities in it, even though the values should be
moderate size.
What are my options here?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
More information about the R-help
mailing list