-
-
Notifications
You must be signed in to change notification settings - Fork 667
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
BREAKING CHANGE: Unify Math & Mathf. Make every method in Math polymorphic #2335
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/math
NativeMath#scalebn
NativeMath#rem
NativeMath#mod
(but not tests)NativeMathf
completelyMath.random
(forf64
type)Caveats:
Before this PR this will create unnecessary cast to f64,
Math.floor
and downcast toi32
. With this PR this code now equivalent tox / y
without all this unnecessary work due toMath.floor
,Math.trunc
and 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?