Description: fix infinite loop in Boost.multiprecision
 Multiprecision acos(), asin() and atan() sometimes loop infinitely when
 they should converge exactly because of the way the distance between the
 current and target value is compared to zero.
Author: Thibaut Paumard <thibaut@debian.org>
Origin: vendor
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844495
Forwarded: not-needed
Last-Update: 2016-11-25
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: boost1.62-1.62.0+dfsg/boost/multiprecision/detail/functions/trig.hpp
===================================================================
--- boost1.62-1.62.0+dfsg.orig/boost/multiprecision/detail/functions/trig.hpp
+++ boost1.62-1.62.0+dfsg/boost/multiprecision/detail/functions/trig.hpp
@@ -515,10 +515,8 @@ void eval_asin(T& result, const T& x)
       eval_divide(sine, cosine);
       eval_subtract(result, sine);
       current_precision = eval_ilogb(sine);
-#ifdef FP_ILOGB0
-      if(current_precision == FP_ILOGB0)
+      if(sine.iszero())
          break;
-#endif
    }
    if(b_neg)
       result.negate();
@@ -662,10 +660,8 @@ void eval_atan(T& result, const T& x)
       eval_multiply(s, t, c);
       eval_add(result, s);
       current_precision = eval_ilogb(s);
-#ifdef FP_ILOGB0
-      if(current_precision == FP_ILOGB0)
+      if(s.iszero())
          break;
-#endif
    }
    if(b_neg)
       result.negate();
