x, y | fdim(x, y) |
---|---|
x > y | x - y |
x <= y | +0.0 |
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)));
Returns the positive difference between x and y.
Equivalent to fmax(x-y, 0).