BigFixed.opOpAssign

Implements bitwise assignment operators from BigInt of the form `BigFixed op= BigInt

  1. BigFixed opOpAssign(T y)
  2. BigFixed opOpAssign(T y)
  3. BigFixed opOpAssign(T y)
    struct BigFixed
    pure nothrow
    opOpAssign
    (
    string op
    T : BigInt
    )
    (
    T y
    )
    if (
    op == "+" ||
    op == "-"
    ||
    op == "*"
    ||
    op == "/"
    ||
    op == "|"
    ||
    op == "&"
    ||
    op == "^"
    )

Examples

auto b1 = BigFixed(1, 10);
b1 /= BigInt(4);
assert(b1.toDecimalString(2) == "0.25");
b1 += BigInt(1);
assert(b1.toDecimalString(2) == "1.25");
b1 *= BigInt(2);
assert(b1.toDecimalString(2) == "2.50");
b1 -= BigInt(1);
assert(b1.toDecimalString(2) == "1.50");
b1 |= BigInt(1 << 5);
assert(b1.toDecimalString(5) == "1.53125");
b1 &= BigInt(1 << 5);
assert(b1.toDecimalString(5) == "0.03125");
b1 ^= BigInt(1 << 5);
assert(b1.toDecimalString(5) == "0.00000");

Meta