Boost C++ Libraries: Ticket #8798: pow(cpp_dec_float_type(0), cpp_dec_float_type(n)) != 0 for n > 1 https://svn.boost.org/trac10/ticket/8798 <p> The overload of 'pow' taking both arguments of number&lt;cpp_dec_float&lt;...&gt;&gt; gives a wrong answer when the base == 0 and the exponent &gt; 1. </p> <p> eg. </p> <pre class="wiki">using T = cpp_dec_float_50; assert( pow(T(0), T(2)) == 0 ); // Failure </pre><p> Tested against svn <a class="missing ticket">#84980</a> with clang (Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)) target: x86_64-apple-darwin12.4.0 with: -std=c++11 -stdlib=libc++ </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8798 Trac 1.4.3 Jan Bouwer <JBouwer@…> Mon, 08 Jul 2013 12:47:17 GMT attachment set https://svn.boost.org/trac10/ticket/8798 https://svn.boost.org/trac10/ticket/8798 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_multiprecision_power_demo.cpp</span> </li> </ul> <p> Demonstration of the error </p> Ticket Jan Bouwer <JBouwer@…> Mon, 08 Jul 2013 13:06:23 GMT attachment set https://svn.boost.org/trac10/ticket/8798 https://svn.boost.org/trac10/ticket/8798 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_multiprecision_power_demo.2.cpp</span> </li> </ul> <p> Demonstration of the error - without annoyance, please remove previous </p> Ticket Jan Bouwer <JBouwer@…> Tue, 09 Jul 2013 06:04:28 GMT <link>https://svn.boost.org/trac10/ticket/8798#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8798#comment:1</guid> <description> <p> Output of the attached code: </p> <pre class="wiki">pow(0, 0) = 1 pow(0, 1) = 0 pow(0, 2) = 0 pow(1, 0) = 1 pow(1, 1) = 1 pow(1, 2) = 1 pow(2, 0) = 1 pow(2, 1) = 2 pow(2, 2) = 4 pow(0, 0) = 1 pow(0, 1) = 0 pow(0, 2) = 1 - Unexpected! pow(1, 0) = 1 pow(1, 1) = 1 pow(1, 2) = 1 pow(2, 0) = 1 pow(2, 1) = 2 pow(2, 2) = 4 pow(0, 0) = 1 pow(0, 1) = 0 pow(0, 2) = 1 - Unexpected! pow(1, 0) = 1 pow(1, 1) = 1 pow(1, 2) = 1 pow(2, 0) = 1 pow(2, 1) = 2 pow(2, 2) = 4 pow(0, 0) = 1 pow(0, 1) = 0 pow(0, 2) = 1 - Unexpected! pow(1, 0) = 1 pow(1, 1) = 1 pow(1, 2) = 1 pow(2, 0) = 1 pow(2, 1) = 2 pow(2, 2) = 4 </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 10 Jul 2013 16:08:14 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8798#comment:2 https://svn.boost.org/trac10/ticket/8798#comment:2 <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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/84997" title="Fix bug in eval_pow that causes 0^N to be none-zero. Fixes #8798.">[84997]</a>) Fix bug in eval_pow that causes 0<sup>N to be none-zero. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8798" title="#8798: Bugs: pow(cpp_dec_float_type(0), cpp_dec_float_type(n)) != 0 for n &gt; 1 (closed: fixed)">#8798</a>. </sup></p> Ticket