Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork669
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 ourterms of service andprivacy 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?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
dcodeIO commentedJun 25, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
So far, |
MaxGraey commentedJun 25, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
abs, floor, ceil, round etc will be work properly with integers even in JSMath due to |
Uh oh!
There was an error while loading.Please reload this page.
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?