bigIntMod
bigIntMod(
dividend,divisor):bigint
Defined in: packages/core/src/big-int/mod.ts:15
Floored remainder — takes the sign of the divisor, so it pairs with
bigIntDivFloor: dividend === bigIntDivFloor(a, b) * b + bigIntMod(a, b).
This is what mod names in Knuth, Haskell, Lisp, Ada, Julia and Ruby, and
what Python’s % computes. It is not bigint’s %, which takes the sign of
the dividend: -7n % 2n is -1n, while bigIntMod(-7n, 2n) is 1n.
For a remainder that stays non-negative even when the divisor is negative, use bigIntModEuclid.
Parameters
Section titled “Parameters”dividend
Section titled “dividend”bigint
divisor
Section titled “divisor”bigint
Returns
Section titled “Returns”bigint
Throws
Section titled “Throws”When divisor is zero.