Commit 41bc867a authored by Mateusz Baran's avatar Mateusz Baran Committed by Davis E. King

optimization - poly_min_extrap fixed for a specific case (#291)

If temp is nonzero but a subnormal then temp2 matrix may contain infinities which may cause temp assignment in line 225 to be a NaN (as a difference of two positive infinities).
parent d27511b4
......@@ -212,7 +212,7 @@ namespace dlib
double temp = aa2*aa1*(x1-x2);
// just take a guess if this happens
if (temp == 0)
if (temp == 0 || std::fpclassify(temp) == FP_SUBNORMAL)
{
return x1/2.0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment