fabs

Returns |x|

Special Values
xfabs(x)
±0.0+0.0
±∞+∞
  1. real fabs(real x)
    pragma(inline, true) @safe pure nothrow @nogc
    real
    fabs
    (
    real x
    )
  2. double fabs(double x)
  3. float fabs(float x)

Examples

import std.math.traits : isIdentical;

assert(isIdentical(fabs(0.0f), 0.0f));
assert(isIdentical(fabs(-0.0f), 0.0f));
assert(fabs(-10.0f) == 10.0f);

assert(isIdentical(fabs(0.0), 0.0));
assert(isIdentical(fabs(-0.0), 0.0));
assert(fabs(-10.0) == 10.0);

assert(isIdentical(fabs(0.0L), 0.0L));
assert(isIdentical(fabs(-0.0L), 0.0L));
assert(fabs(-10.0L) == 10.0L);

Meta