[LCP]Base 2 logarithms
Chuck Martin
nrocinu at myrealbox.com
Thu Oct 3 21:06:39 UTC 2002
On Thu, Oct 03, 2002 at 01:02:23PM +0100, Vincent Penquerc'h wrote:
> > This won't work for numbers less than zero (negative logarithms).
>
> But a logarithm is undefined for negative numbers, isn't it ?
I was referring to negative logarithms, not logarithms of negative
numbers, although I believe those are also possible if you allow
imaginary and complex numbers.
Some examples of negative logarithms would be log2(1/2), which should
be -1, or log2(1/8), which should be -3.
> Then I guess you can approximate this using the Newton method
> (as used for square root). Never tried it, but should work.
I'm not sure what that method is. Would that be the trial-and-error
method?
Chuck
More information about the linuxCprogramming
mailing list