abs

fnauto abs(Num)(Num x) if (isIntegral!Num || (is(typeof(Num.init >= 0)) && is(typeof(- Num.init)))) @nogc nothrow pure

Calculates the absolute value of a number.

Parameters

Num(template parameter) type of number
xreal number value

Returns

The absolute value of the number. If floating-point or integral,

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.