BigFixed.opBinary

Implements binary operators between BigFixed

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

Examples

auto b1 = BigFixed(1, 10);
assert((b1 / BigFixed(4, 10)).toDecimalString(2) == "0.25");
assert((b1 + BigFixed(2, 10)).toDecimalString(2) == "3.00");
assert((b1 * BigFixed(2, 10)).toDecimalString(2) == "2.00");
assert((b1 - BigFixed(1, 10)).toDecimalString(2) == "0.00");

Meta