Decimal.opBinaryRight

Implementation of binary and assignment operators (+, -, *, /, %, ^^).

  1. auto opBinary(T value)
  2. auto opBinaryRight(T value)
    struct Decimal(int bits)
    const
    opBinaryRight
    (
    string op
    T
    )
    (
    auto const ref T value
    )
    if (
    op == "+" ||
    op == "-"
    ||
    op == "*"
    ||
    op == "/"
    ||
    op == "%"
    ||
    op == "^^"
    )
    if (
    bits == 32 ||
    bits == 64
    ||
    bits == 128
    )
  3. auto opOpAssign(T value)

Return Value

Type: auto

the widest _decimal value as result of the operation

Supported types

_decimal, floating point, integral, char Exceptions:

LeftOpRightResultInvalidDiv0OverflowUnderflowInexact
NaNanyanyNaN✓
anyanyNaNNaN✓
+∞+-∞NaN✓
+∞+any+∞
any++∞+∞
-∞++∞NaN✓
-∞+any-∞
any+-∞-∞
any+anyany✓✓✓
+∞-+∞NaN✓
+∞-any+∞
any-+∞-∞
-∞--∞NaN✓
-∞-any-∞
any--∞-∞
any-anyany✓✓✓
±∞*0.0NaN✓
±∞*any±∞
any*anyany
±∞/±∞NaN✓
0.0/0.0NaN✓
±∞/any±∞
any/0.0±∞✓
any/anyany✓✓✓
±∞%anyNaN✓
any%±∞NaN✓
any%0.0NaN✓
any%anyany✓✓✓

Meta