AngouriMath

Try it live

Navigation

← Back to list of members

op_Modulus​(AngouriMath.​Entity.​Number.​Real,​AngouriMath.​Entity.​Number.​Real)

 Method (no overloads)

Summary

The floored remainder, which takes the sign of the divisor: -7 % 3 is 2 and
7 % (-3) is -2. See https://github.com/asc-community/AngouriMath/issues/708.

Remarks

This one used to truncate and so took the sign of the dividend, disagreeing
with the same operator on Integer and on
Rational -- which one applied depended on the static type at
the call site rather than on the values.
Two ratios are divided as ratios, whatever their static type. Their decimals
are rounded, and a remainder jumps at every multiple of the divisor: 6 % (1/27)
is 0, and with 1/27 rounded up in its last digit the quotient fell just short
of 162, so it came back as 1/27. And a quotient wider than the working
precision has no decimal remainder at all, so 10^200 % 7 was NaN.

























Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6091 pages online