Decimal.opBinary

Performs a binary operation between two decimals, or a decimal and a built in number.

The result has the hook of the left hand side. On non-assignment operations invalid operations do not effect the left hand side of the operation.

When the right hand side is a built-in numeric type, the default hook Abort is used for its decimal representation.

  1. auto opBinary(T rhs)
    struct Decimal(Hook = Abort)
    const
    opBinary
    (
    string op
    T
    )
    (
    T rhs
    )
    if (
    op == "+" ||
    op == "-"
    ||
    op == "*"
    ||
    op == "/"
    )
  2. Decimal!(Hook) opOpAssign(T rhs)

Parameters

rhs T

the right-hand side of the operation

Exceptional Conditions

invalidOperation is flagged under the following conditions

  • Adding Infinity and -Infinity, and vice-versa
  • Multiplying +/-Infinity by +/-zero
  • Dividing anything but zero by zero
  • Dividing +/-Infinity by +/-Infinity

divisionByZero is flagged when dividing anything but zero by zero

Meta