Ticket #12625: no-fp-ilogb0

File no-fp-ilogb0, 1.4 KB (added by steve@…, 6 years ago)

patch for bug

Line 
1Description: fix infinite loop in Boost.multiprecision
2 Multiprecision acos(), asin() and atan() sometimes loop infinitely when
3 they should converge exactly because of the way the distance between the
4 current and target value is compared to zero.
5Author: Thibaut Paumard <thibaut@debian.org>
6Origin: vendor
7Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844495
8Forwarded: no
9Last-Update: 2016-11-25
10---
11This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
12Index: boost1.62-1.62.0+dfsg/boost/multiprecision/detail/functions/trig.hpp
13===================================================================
14--- boost1.62-1.62.0+dfsg.orig/boost/multiprecision/detail/functions/trig.hpp
15+++ boost1.62-1.62.0+dfsg/boost/multiprecision/detail/functions/trig.hpp
16@@ -515,10 +515,8 @@ void eval_asin(T& result, const T& x)
17 eval_divide(sine, cosine);
18 eval_subtract(result, sine);
19 current_precision = eval_ilogb(sine);
20-#ifdef FP_ILOGB0
21- if(current_precision == FP_ILOGB0)
22+ if(sine.iszero())
23 break;
24-#endif
25 }
26 if(b_neg)
27 result.negate();
28@@ -662,10 +660,8 @@ void eval_atan(T& result, const T& x)
29 eval_multiply(s, t, c);
30 eval_add(result, s);
31 current_precision = eval_ilogb(s);
32-#ifdef FP_ILOGB0
33- if(current_precision == FP_ILOGB0)
34+ if(s.iszero())
35 break;
36-#endif
37 }
38 if(b_neg)
39 result.negate();