Absolute value of x.
int i = -1; assert(i.abs == 1); static assert(is(typeof(i.abs) == int)); uint u = 1; assert(u.abs == 1); static assert(is(typeof(u.abs) == uint));
float f = -1.64; assert(f.abs == 1.64F); static assert(is(typeof(f.abs) == float)); double d = -1.64; assert(d.abs == 1.64); static assert(is(typeof(d.abs) == double)); real r = -1.64; assert(r.abs == 1.64L); static assert(is(typeof(r.abs) == real));
Calculates the absolute value of a number.