-
-
Couldn't load subscription status.
- Fork 677
BREAKING CHANGE: Unify Math & Mathf. Make every method in Math polymorphic #2335
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
base: main
Are you sure you want to change the base?
Conversation
|
So far, |
|
abs, floor, ceil, round etc will be work properly with integers even in JSMath due to |
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?