BigInt.opBinary

Implements a narrowing remainder operation with built-in integer types.

This binary operator returns a narrower, built-in integer type where applicable, according to the following table.

,
BigInt$(CODE_PERCENT)uint$(RARR)long
BigInt$(CODE_PERCENT)long$(RARR)long
BigInt$(CODE_PERCENT)ulong$(RARR)BigInt
BigInt$(CODE_PERCENT)other type$(RARR)int
  1. BigInt opBinary(T y)
  2. BigInt opBinary(T y)
  3. auto opBinary(T y)
    struct BigInt
    pure nothrow @safe const
    opBinary
    (
    string op
    T
    )
    (
    T y
    )
    if (
    op == "%" &&
    )

Examples

auto  x  = BigInt("1_000_000_500");
long  l  = 1_000_000L;
ulong ul = 2_000_000UL;
int   i  = 500_000;
short s  = 30_000;

assert(is(typeof(x % l)  == long)   && x % l  == 500L);
assert(is(typeof(x % ul) == BigInt) && x % ul == BigInt(500));
assert(is(typeof(x % i)  == int)    && x % i  == 500);
assert(is(typeof(x % s)  == int)    && x % s  == 10500);

Meta