BREAKING CHANGE: Unify Math & Mathf. Make every method in Math polymorphic#2335
BREAKING CHANGE: Unify Math & Mathf. Make every method in Math polymorphic#2335MaxGraey wants to merge 14 commits intoAssemblyScript:mainfrom
Conversation
|
So far, |
|
abs, floor, ceil, round etc will be work properly with integers even in JSMath due to |
|
Has this been solved? It has been almost 3 years since the last commit. Also maybe casting the type to f64 could make sense in this case? |
In this PR we're doing several breaking changes:
std/util/mathNativeMath#scalebnNativeMath#remNativeMath#mod(but not tests)NativeMathfcompletelyMath.random(forf64type)Caveats:
Before this PR this will create unnecessary cast to f64,
Math.floorand downcast toi32. With this PR this code now equivalent tox / ywithout all this unnecessary work due toMath.floor,Math.truncand etc accept integers and pass through it "as is".This is the most painful caveat, which can lead to many breaking changes in some code.
Perhaps we could add new generic builtin helper which forces parameter type to float. Something like:
Thoughts?