powered by
Implements the "Log-Sum-Exponential trick" for calculating the log of the sums of exponents without arithmetic underflows. This allows very small numbers to be summed in log space.
lse(a, b)
The log of the sum of the exponents of a and b.
A numeric log value.
Another numeric log value.
A <- 1E-40 B <- 3E-41 log_AB <- lse( log(A), log(B) ) # exp( log_AB ) == A + B
Run the code above in your browser using DataLab