Boost C++ Libraries: Ticket #11054: Floating-point comparison of multiprecision values fails if expression template is on https://svn.boost.org/trac10/ticket/11054 <p> Floating-point comparison of multiprecision values fails if expression template option is on (which is the default for example with </p> <pre class="wiki">boost::multiprecision::cpp_bin_float_50; typedef boost::multiprecision::number&lt;boost::multiprecision::cpp_bin_float&lt;50&gt;, boost::multiprecision::et_on&gt; cpp_bin_float_50_et_on; // et_on is default so is same as cpp_bin_float_50.) </pre><p> The error appears inside Boost.test floating_point_comparision.hpp at an apparently impossible place fpc_detail::fpt_abs. </p> <p> The actual problem is in class close_at_tolerance operator() line 204 </p> <pre class="wiki"> FPT diff = fpc_detail::fpt_abs(left - right); </pre><p> in order to allow use of expression templates, it is necessary to cast the variable diff to the FPT explicitly, thus: </p> <pre class="wiki"> FPT diff = fpc_detail::fpt_abs( static_cast&lt;FPT&gt;(left - right) ); </pre><p> I can provide an explicit test for this, but it seems such a trivial change. </p> <p> This change is vital to allow Boost.Test to be used fully with Boost.Multiprecision. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11054 Trac 1.4.3 Raffi Enficiaud Tue, 17 Mar 2015 21:37:20 GMT owner changed https://svn.boost.org/trac10/ticket/11054#comment:1 https://svn.boost.org/trac10/ticket/11054#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Gennadiy Rozental</span> to <span class="trac-author">Raffi Enficiaud</span> </li> </ul> Ticket Raffi Enficiaud Tue, 17 Mar 2015 21:38:59 GMT <link>https://svn.boost.org/trac10/ticket/11054#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11054#comment:2</guid> <description> <p> From the email exchanges, seems to work on the branch local/doc_floating_point_fixes. What remains for the issue is to have a proper unit test on this for multiprecision. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Raffi Enficiaud</dc:creator> <pubDate>Tue, 17 Mar 2015 21:43:50 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/11054#comment:3 https://svn.boost.org/trac10/ticket/11054#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Raffi Enficiaud Wed, 22 Apr 2015 18:20:23 GMT version changed https://svn.boost.org/trac10/ticket/11054#comment:4 https://svn.boost.org/trac10/ticket/11054#comment:4 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.58.0</span> → <span class="trac-field-new">Boost 1.59.0</span> </li> </ul> <p> merged to develop 47829d34593d9ca52de0d0a8b798b128f9ffa71f </p> Ticket Raffi Enficiaud Tue, 07 Jul 2015 08:38:31 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/11054#comment:5 https://svn.boost.org/trac10/ticket/11054#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.59.0</span> </li> </ul> Ticket