-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Adding a Difference method to the Math module #14740
Comments
That would be just |
I went digging for a difference method after trying So that's my mistake, I suppose that is sort of silly now. That being said, I don't know of it being a thing in other languages stdlibs. But it seems like such a fundamental operation for two numbers, I guess I'm just surprised it isn't inbuilt - especially when there are tons of trig functions. If there are absolute basics of plus, minus, multiply, and divide, and beyond basics of trig functions, you'd think difference falling somewhere in-between would be included. |
@ysbaddaden Glad you reference #14587, because that was also one of the solutions I tried, and was disappointed to find it didn't work as expected. |
Discussion
Math.diff(a,b)
method to the Math module for each type (ints, floats, etc).Difference is just the smaller number subtracted from the larger number to return the gap between.
Math.max(a,b) - Math.min(a,b)
I would be willing to make a pr.
The text was updated successfully, but these errors were encountered: