You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BigInt also has a specialized function for computing both results together, similar to its current #divmod override. I think we should add such a method for completeness. In other languages:
Number
has a#divmod
method, which returns the floored quotient (#//
) and the modulus (#%
) as a 2-tuple:crystal/src/number.cr
Lines 217 to 219 in 791b0e4
There is no counterpart for the truncated quotient (
#tdiv
) and remainder (#remainder
). Two examples in the standard library are:crystal/src/int.cr
Lines 667 to 668 in 791b0e4
crystal/src/time/span.cr
Lines 68 to 69 in 791b0e4
BigInt
also has a specialized function for computing both results together, similar to its current#divmod
override. I think we should add such a method for completeness. In other languages:div
,ldiv
,lldiv
,imaxdiv
(there is no#divmod
equivalent)System.Math.DivRem
(there is no#divmod
equivalent)java.math.BigInteger.divideAndRemainder
(there is no#divmod
equivalent)quotRem
divmod
is presentIf we want to emphasize the similarity with the floored version,
#tdivmod
is also a possible candidate.The text was updated successfully, but these errors were encountered: