-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make the behavior of mod for BigNumber and Fraction consistent with the behavior of number #2630
Comments
[Took the liberty of fixing the zeros in the issue statement to be 22s] |
Ah, yes, thanks 😅 |
@josdejong @gwhitney if this is still open I'd like to work on this issue. |
Thanks @mdeshpande12 , your help is very welcome! A quick check shows that this behavior seems to be consistent for BigNumber now, but not yet for Fraction. It would be good though to have a more thorough look at both the behavior of |
…with the behavior of number josdejong#2630
@josdejong I did a little exploration of myself and it turns out, behaviour is consistent for both BigNumber, Fraction as that of the number in the latest version. Details are as follows: Latest Version of mathjs: 12.2.1 Please refer to the attached screenshots: Result: I believe this issue is resolved with the latest version, and can be closed |
Ha, you're right! I did another quick test too, and the original issue doesn't occur anymore. That's good news :) |
Discovered during the discussion in #2617: in mathjs,
mod
is implemented the mathematical way, which differs a bit from the typical programmatical way:math.mod(22, 0)
returns22
. However, this behavior is not yet implemented forBigNumber
andFraction
. We should make that behavior consistent:The behavior of
mod
for numbers is implemented as follows, we should do the same forBigNumber
andFraction
:mathjs/src/plain/number/arithmetic.js
Lines 159 to 171 in 09a044f
Help would be welcome. Anyone interested in picking this up?
The text was updated successfully, but these errors were encountered: