Get the absolute value of num. Because the return type is always unsigned, overflow is not possible.
1 import checkedint.sticky : smartOp; // smartOp.abs() never throws 2 3 assert(smartOp.abs(int.min) == std.math.pow(2.0, 31)); 4 assert(smartOp.abs(-25) == 25u); 5 assert(smartOp.abs(745u) == 745u);
See Implementation
Get the absolute value of num. Because the return type is always unsigned, overflow is not possible.