[R] Exponentiate very large numbers
Rui Barradas
ruipbarradas at sapo.pt
Mon Feb 4 19:53:07 CET 2013
Hello,
Use a simple transfomation. Divide both t
log.a <- 1347
log.b <- 1351
tmp1 <- exp(log.a - log(0.1) - log.b) - 1
result <- tmp1 * exp(0.1 + log.b) # -Inf
Using base 10, the result would be
-4.405386507*10^585
a number too large for R. See the help page ?.Machine
Hope this helps,
Rui Barradas
Em 04-02-2013 15:11, francesca casalino escreveu:
> Dear R experts,
>
> I have the logarithms of 2 values:
>
> log(a) = 1347
> log(b) = 1351
>
> And I am trying to solve this expression:
>
> exp( ln(a) ) - exp( ln(0.1) + ln(b) )
>
> But of course every time I try to exponentiate the log(a) or log(b)
> values I get Inf. Are there any tricks I can use to get a real result
> for exp( ln(a) ) - exp( ln(0.1) + ln(b) ), either in logarithm or
> exponential form?
>
>
> Thank you very much for the help
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list