[Boost-bugs] [Boost C++ Libraries] #11054: Floating-point comparison of multiprecision values fails if expression template is on

Subject: [Boost-bugs] [Boost C++ Libraries] #11054: Floating-point comparison of multiprecision values fails if expression template is on
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-02-24 12:23:08


#11054: Floating-point comparison of multiprecision values fails if expression
template is on
-----------------------------------------------------+---------------------
 Reporter: pbristow | Owner: rogeeff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: test
  Version: Boost 1.58.0 | Severity: Problem
 Keywords: test multiprecision expression template |
-----------------------------------------------------+---------------------
 Floating-point comparison of multiprecision values fails if expression
 template option is
 on (which is the default for example with
 {{{
 boost::multiprecision::cpp_bin_float_50;

 typedef
 boost::multiprecision::number<boost::multiprecision::cpp_bin_float<50>,
   boost::multiprecision::et_on>
   cpp_bin_float_50_et_on; // et_on is default so is same as
 cpp_bin_float_50.)
 }}}

 The error appears inside Boost.test floating_point_comparision.hpp at an
 apparently impossible place fpc_detail::fpt_abs.

 The actual problem is in class close_at_tolerance operator() line 204

 {{{
    FPT diff = fpc_detail::fpt_abs(left - right);
 }}}
 in order to allow use of expression templates, it is necessary to cast the
 variable diff to the FPT explicitly, thus:
 {{{
    FPT diff = fpc_detail::fpt_abs( static_cast<FPT>(left - right) );
 }}}

 I can provide an explicit test for this, but it seems such a trivial
 change.

 This change is vital to allow Boost.Test to be used fully with
 Boost.Multiprecision.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11054>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC