-
-
Notifications
You must be signed in to change notification settings - Fork 676
New log, log2, exp, exp2 and pow implementations #992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I decided add new non-std Math functions 2 ** y -> exp2(y)
e ** y -> exp(y)
// where y is f32 or f64 and result also f32 or f64 |
Can you explain a bit what's the theory behind these improvements? For instance, what did the old implementation do that made it slow, and does the new implementation do that makes it fast? What are the algorithms used here and where are they from? Stuff like that :) |
Basicaly it's adoption of new ARM math lib: https://github.com/ARM-software/optimized-routines/tree/master/math (MIT). This link present in musl's implementation. New routines use lookup tables and more clever handling special cases when we could simplify path using twofold fast arithmetic some of LUTs need for speedup FMA emulation. All this significantly speedup pow/log/exp. But sometimes increase code size, so I use this routines mostly for |
Great, thanks! |
Status
Math.log2
and opt in future)Benchmark for
Math.pow
[f64]Results
Benchmark for
Mathf.pow
[f32]UPDATE
Benchmark for
Math.pow
[f64] using internal loops in AssemblyScript