Boost C++ Libraries: Ticket #12625: multiprecision acos() sometimes does not return https://svn.boost.org/trac10/ticket/12625 <p> Thibaut Paumard reported the following bug to Debian as <a class="ext-link" href="https://bugs.debian.org/844495"><span class="icon">​</span>https://bugs.debian.org/844495</a> </p> <p> Some inputs cause multiprecision acos() to hang. The following example hangs on s390x: </p> <pre class="wiki">#include &lt;boost/multiprecision/cpp_dec_float.hpp&gt; int main(int argc, char** argv) { boost::multiprecision::cpp_dec_float_100 alpha100, a, b; alpha100=5.9839860068377014046259e-02; b=cos(alpha100); a=acos(b); return 0; } </pre><p> Known affected architectures include arm64 armel armhf mips64el mipsel ppc64el s390x powerpc ppc64. It's not clear to me whether the value of alpha100 needs to be adjusted to trigger the bug on different architectures. </p> <p> Thibaut has proposed the attached patch. Would appreciate knowing the maintainer's thoughts about the patch. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12625 Trac 1.4.3 steve@… Sat, 26 Nov 2016 03:41:58 GMT attachment set https://svn.boost.org/trac10/ticket/12625 https://svn.boost.org/trac10/ticket/12625 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">no-fp-ilogb0</span> </li> </ul> <p> patch for bug </p> Ticket Thibaut Paumard <thibaut@…> Sat, 26 Nov 2016 12:02:24 GMT cc changed https://svn.boost.org/trac10/ticket/12625#comment:1 https://svn.boost.org/trac10/ticket/12625#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">thibaut@…</span> added </li> </ul> Ticket Thibaut Paumard <thibaut@…> Sun, 27 Nov 2016 09:30:43 GMT <link>https://svn.boost.org/trac10/ticket/12625#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12625#comment:2</guid> <description> <p> Hi, </p> <p> Although I haven't yet been able to demonstrate that acos() can hang on amd64, I confirm that ilogb(zero) is also 0 for a multiprecision zero on this architecture, therefore comparing it to FP_ILPOGB0 does not make sense: </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;boost/multiprecision/cpp_dec_float.hpp&gt;</span><span class="cp"></span> <span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span> <span class="p">{</span> <span class="n">boost</span><span class="o">::</span><span class="n">multiprecision</span><span class="o">::</span><span class="n">number</span><span class="o">&lt;</span><span class="n">boost</span><span class="o">::</span><span class="n">multiprecision</span><span class="o">::</span><span class="n">cpp_dec_float</span><span class="o">&lt;</span><span class="mi">100</span><span class="o">&gt;</span> <span class="o">&gt;</span> <span class="n">zero</span><span class="p">(</span><span class="s">&quot;0.&quot;</span><span class="p">);</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">ilogb</span><span class="p">(</span><span class="n">zero</span><span class="p">)</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">FP_ILOGB0</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><p> Kind regards, Thibaut. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sat, 03 Dec 2016 11:54:12 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12625#comment:3 https://svn.boost.org/trac10/ticket/12625#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> The attached patch fixes things for cpp_dec_float, but completely breaks other types in the library (as you would quickly discover running the regression tests). This is now fixed in develop in a series of commits: </p> <p> <a class="ext-link" href="https://github.com/boostorg/multiprecision/commit/138a9055e2edc68dca2e78ff97ffe6276c17fa0a"><span class="icon">​</span>https://github.com/boostorg/multiprecision/commit/138a9055e2edc68dca2e78ff97ffe6276c17fa0a</a> <a class="ext-link" href="https://github.com/boostorg/multiprecision/commit/26ceb6ef386f5fb879ddccca59cc3bdc57c124f3"><span class="icon">​</span>https://github.com/boostorg/multiprecision/commit/26ceb6ef386f5fb879ddccca59cc3bdc57c124f3</a> <a class="ext-link" href="https://github.com/boostorg/multiprecision/commit/c0df5b6747d09268256b59501c3cab746112268e"><span class="icon">​</span>https://github.com/boostorg/multiprecision/commit/c0df5b6747d09268256b59501c3cab746112268e</a> </p> <p> These mostly relate to issue <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12581" title="#12581: Feature Requests: cpp_bin_float: Anal fixation. Part 4. Special cases of atan2() (closed: fixed)">#12581</a> but fix this one as well. </p> Ticket