Hyperlinkv0.8.0-beta.28

BigInt

BigInt.remainderconsteffect/BigInt.ts:951
(divisor: bigint): (self: bigint) => bigint
(self: bigint, divisor: bigint): bigint

Returns the JavaScript remainder of dividing one bigint by another.

When to use

Use when you want native remainder semantics, including signed remainders and a thrown division-by-zero error.

Gotchas

Throws a RangeError when the divisor is 0n.

Example (Calculating remainders)

import { BigInt } from "effect"

BigInt.remainder(10n, 3n) // 1n

BigInt.remainder(15n, 4n) // 3n
mathdivide
Source effect/BigInt.ts:9514 lines
export const remainder: {
  (divisor: bigint): (self: bigint) => bigint
  (self: bigint, divisor: bigint): bigint
} = dual(2, (self: bigint, divisor: bigint): bigint => self % divisor)