diff --git a/dlib/optimization/optimization_line_search.h b/dlib/optimization/optimization_line_search.h index b25d7d1e2..a91e3df84 100644 --- a/dlib/optimization/optimization_line_search.h +++ b/dlib/optimization/optimization_line_search.h @@ -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; }