I want to represent the following number using the log function:
2.5e-600/1.7e-500
here is what I did on paper, and what I would like to automate on R for any given number:
log(2.5e-600/1.7e-500) = log(2.5e-600)-log(1.7e-500)
= log(2.5)-600*log(10) - log(1.7) + 500*log(10)
= -229.8728
However, I am thinking that on R it won't be as straight forward to go from log(10^-600) to -600*log(10)
. Because R evaluates the inside expression first then applies the log function which gives -Inf
instead of -1381.511
My question is how can I remedy to that problem? I am thinking that maybe there is a function that would allow me to retrieve the exponent part of a number ? same question for going from log(2.5e-600) to log(2.5)-600*log(10)