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).
This commit is contained in:
Mateusz Baran 2016-10-14 12:54:59 +02:00 committed by Davis E. King
parent d27511b40a
commit 41bc867a4d
1 changed files with 1 additions and 1 deletions

View File

@ -212,7 +212,7 @@ namespace dlib
double temp = aa2*aa1*(x1-x2); double temp = aa2*aa1*(x1-x2);
// just take a guess if this happens // just take a guess if this happens
if (temp == 0) if (temp == 0 || std::fpclassify(temp) == FP_SUBNORMAL)
{ {
return x1/2.0; return x1/2.0;
} }