mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 05:30:33 +03:00
Optimization: Move NaN-check inside branch where it is guaranteed to happen
This commit is contained in:
parent
91aa5feead
commit
63ce5c37c0
1 changed files with 3 additions and 3 deletions
|
@ -322,10 +322,10 @@ if (isFloatingPoint!T)
|
||||||
u = fabs(y);
|
u = fabs(y);
|
||||||
if (u == T.infinity) return u; // hypot(inf, nan) == inf
|
if (u == T.infinity) return u; // hypot(inf, nan) == inf
|
||||||
if (v == T.infinity) return v; // hypot(nan, inf) == inf
|
if (v == T.infinity) return v; // hypot(nan, inf) == inf
|
||||||
}
|
|
||||||
|
|
||||||
if (u.isNaN || v.isNaN)
|
if (u.isNaN || v.isNaN)
|
||||||
return T.nan;
|
return T.nan;
|
||||||
|
}
|
||||||
|
assert(!(u.isNaN || v.isNaN), "Comparison to NaN always fails, thus is is always handled in the branch above");
|
||||||
|
|
||||||
const maxabs = max(u,v);
|
const maxabs = max(u,v);
|
||||||
if (v == 0.0)
|
if (v == 0.0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue