mirror of https://github.com/davisking/dlib.git
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:
parent
d27511b40a
commit
41bc867a4d
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue