Comment #10 on issue 3579 by [email protected]: Math.log2 and Math.log10 should be exact for exact powers
https://code.google.com/p/v8/issues/detail?id=3579

Here is an implementation of log2. fdlibm does not have an explicit log2 function, but there is one buried in the implementation of pow. I've extracted out the relevant parts into it's own function. I do not know if there are any guarantees on accuracy or even bounds. The few tests that I've done indicate that it is at least as good as the current Math.log2 implementation, and it gets log2(2^n) = n exactly for -1074 <= n <= 1023. That is, all double-float numbers of the form 2^n for n an integer.

Tests program at: https://rtoy.github.io/fdlibm-js/test-log10.html
Tests at: https://rtoy.github.io/fdlibm-js/log2-tests.js
Implementation: https://rtoy.github.io/fdlibm-js/log2.js


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to