BigFixed.opBinary

Implements binary operators between Integer

  1. BigFixed opBinary(T y)
  2. BigFixed opBinary(T y)
  3. BigFixed opBinary(T y)
    struct BigFixed
    pure nothrow const
    opBinary
    (
    string op
    T
    )
    (
    T y
    )
    if (
    (
    op == "+" ||
    op == "-"
    ||
    op == "*"
    ||
    op == "/"
    ||
    op == ">>"
    ||
    op == "<<"
    ||
    op == "|"
    ||
    op == "&"
    ||
    op == "^"
    )
    &&
    isIntegral!T
    )

Examples

auto b1 = BigFixed(1, 10);
assert((b1 + 1).toDecimalString(2) == "2.00");
assert((b1 - 1).toDecimalString(2) == "0.00");
assert((b1 * 2).toDecimalString(2) == "2.00");
assert((b1 / 2).toDecimalString(2) == "0.50");
assert((b1 >> 1).toDecimalString(2) == "0.50");
assert((b1 << 1).toDecimalString(2) == "2.00");
assert((b1 | (1 << 9)).toDecimalString(2) == "1.50");
assert((b1 & 1).toDecimalString(2) == "0.00");
assert((b1 ^ (1 << 9)).toDecimalString(2) == "1.50");

Meta