fdim

Returns the positive difference between x and y.

Equivalent to fmax(x-y, 0).

@safe pure nothrow @nogc
real
fdim
(
real x
,
real y
)

Return Value

Type: real
Special Values
x, yfdim(x, y)
x > yx - y
x <= y+0.0

Examples

import std.math.traits : isNaN;

assert(fdim(2.0, 0.0) == 2.0);
assert(fdim(-2.0, 0.0) == 0.0);
assert(fdim(real.infinity, 2.0) == real.infinity);
assert(isNaN(fdim(real.nan, 2.0)));
assert(isNaN(fdim(2.0, real.nan)));
assert(isNaN(fdim(real.nan, real.nan)));

Meta