the return type will be the same as the input.
Limitations: When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.
auto abs(Num)(Num x) if (isIntegral!Num || (is(typeof(Num.init >= 0)) && is(typeof(- Num.init)))) @nogc nothrow pureCalculates the absolute value of a number.
Num | (template parameter) type of number |
x | real number value |
the return type will be the same as the input.
Limitations: When x is a signed integral equal to Num.min the value of x will be returned instead. Note for 2's complement; -Num.min (= Num.max + 1) is not representable due to overflow.