Repository navigation
Conversation
…eeds it Math.sin, Math.exp, Math.cbrt, Math.atan2 and the other transcendental functions called the platform libm, whose results differ from Node's in the last bit for many inputs (Math.cbrt(0.3), Math.atan2(2.5, 3)). Node computes them with V8's fdlibm port on every platform; scr_ieee754.c is a C port of that file, and the compiled Math members call it. Math.pow and ** follow V8's math::pow: a literal exponent 2 is x * x, a literal 0.5 is sqrt(x + 0), and every other exponent calls scr_math_pow, which answers V8's special cases (2, 0.5, a NaN base, +-1 ** +-Infinity) before the platform pow. ** called libm's pow, which differs from x * x and sqrt in the last bit for some inputs, and which LLVM may rewrite. On glibc, the runtime defines floor, ceil, trunc, round, fmod, sqrt, ldexp, scalbn and frexp (scr_glibc_math.c), each exact; floor, ceil and trunc select SSE4.1's rounding instruction when the CPU has it, as glibc's do. libm links as needed, so a program that does not call pow starts without loading libm.so.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
Author
|
Superseded by #2287. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
**/Math.pow, now print exactly Node's values (a port of V8's fdlibm, and V8's pow rules).