[LCP]Base 2 logarithms

Vincent Penquerc'h Vincent.Penquerch at artworks.co.uk
Thu Oct 3 19:59:01 UTC 2002


> This won't work for numbers less than zero (negative logarithms).

But a logarithm is undefined for negative numbers, isn't it ?

> Also, it only gives the integer part of the logarithm, which for
> my current needs doesn't really matter, but would be nice to know,
> nevertheless.

Oh. Right. I guess I've worked too much with ints only ;)
Then I guess you can approximate this using the Newton method
(as used for square root). Never tried it, but should work.

-- 
Vincent Penquerc'h 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20021003/fa5adf9a/attachment.htm 


More information about the linuxCprogramming mailing list