lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> frexp is a bit more problematic, but not impossible. One reasonably
> rapid solution would be a binary search in a table of powers of 2;

Note that it is enough to normalize into the interval [1, 2^32) instead of
[0.5, 1).  This can be done by a lookup table of 64 doubles.  Then the
computation would involve 7 lookups, 6 comparisons and a multiplication.
The table would be 512 bytes (IEEE 754 doubles).  Maybe a bit much?

Also numbers like 0, NaN, inf etc. would need special treatment...

Bye,
Wim