Natural Logs?
mhamen3
Posts: 69
Does anyone know how I can perform a floating point natural log in SPIN? Float32 has logs and exponentials but nothing for natural logs. I'm a bit stuck.
Any help would be very appreciated. Thanks
-Marc
Any help would be very appreciated. Thanks
-Marc
Comments
Post #92 of this thread has the most up to date version of F32 I know of.
ln(x) = 2.302585092994046 * log10(x)
a pretty decent legacy to leave us.
John Napier is more than just an interesting point of Trivia. He also invented a kind of calculating machine called Napier's bones (see http://en.wikipedia.org/wiki/Napier's_bones ).
That just went sailing over my head. Any hints on why that works?
Really. Its not a logarithm though.
[ edit: after some testing: Its a poor approximation, several % error, so very limited in utility ]
Yes indeed. However, please allow me to expand...
The number 2.30258... Tracy refers to is simply ln(x) / log(x); or loge(x) / log10(x) to be a bit more rigorous.
In-general, to compute the base y logarithm of x given the ability to find only base z logarithms:
logy(x) = logz(x) / logz(y)
I just took a look at Float32. Its "Log" method is base e so you'd use it to take the natural log of something. The method "Log10" is the base ten log.
As mentioned by Drone and others there are ways to converting the log of one base to another but that's not need in the case of a the natural log.