Decimal.opBinary

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

struct Decimal(int bits)
const
@IEEECompliant("addition", 21)
@IEEECompliant("division", 21)
@IEEECompliant("multiplication", 21)
@IEEECompliant("pow", 42)
@IEEECompliant("pown", 42)
@IEEECompliant("powr", 42)
@IEEECompliant("remainder", 25)
@IEEECompliant("substraction", 21)
opBinary
(
string op
T
)
(
auto const ref T value
)
if (
op == "+" ||
op == "-"
||
op == "*"
||
op == "/"
||
op == "%"
||
op == "^^"
)
if (
bits == 32 ||
bits == 64
||
bits == 128
)

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