Page 1 of 1

[IEEE related] interesting property

Posted: Tue 26 Jun, 2007 4:02 pm
by King Harold
did you know that the exponent + the fraction (excluding the implicit bit) comes really close to the base2 logarithm of the whole number?
the error is highest when the represented number is pow(2,n)-1 and lowest (zero) when the represented number is pow(2,n)
funny thing isn't it? this makes for a fast (if a little inaccurate) base2 logarithmic calculation, ADD. Changing the base to a known number only takes an additional DIVIDE.
error (top is 0.1, numbers range from 1 through 10240)
Image

probably only for positive numbers