The OpenD Programming Language

fmin

Returns the smaller of x and y.

If one of the arguments is a NaN, the other is returned.

pragma(inline, true) @safe pure nothrow @nogc
F
fmin
(
F
)
(
const F x
,
const F y
)
if (
__traits(isFloating, F)
)

Examples

import std.meta : AliasSeq;
static foreach (F; AliasSeq!(float, double, real))
{
    assert(fmin(F(0.0), F(2.0)) == 0.0);
    assert(fmin(F(-2.0), F(0.0)) == -2.0);
    assert(fmin(F.infinity, F(2.0)) == 2.0);
    assert(fmin(F.nan, F(2.0)) == 2.0);
    assert(fmin(F(2.0), F.nan) == 2.0);
}

See Also

std.algorithm.comparison.min is faster because it does not perform the isNaN test.

Meta