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); }
std.algorithm.comparison.min is faster because it does not perform the isNaN test.
Returns the smaller of x and y.
If one of the arguments is a NaN, the other is returned.