[IEEE related] interesting property

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

[IEEE related] interesting property

Post 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)

probably only for positive numbers
Post Reply