Re: [Boost-bugs] [Boost C++ Libraries] #12039: cpp_bin_float convert_to<double>() rounding mistake

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12039: cpp_bin_float convert_to<double>() rounding mistake
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-03-22 08:22:40

#12039: cpp_bin_float convert_to<double>() rounding mistake
  Reporter: Michael Shatz <shatz@…> | Owner: johnmaddock
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: multiprecision
   Version: Boost 1.61.0 | Severity: Problem
Resolution: fixed | Keywords:

Comment (by anonymous):

 OK good, I just pushed a few additional commits, adds an exhaustive
 convert-to-float test program (takes about half a day to run, so not part
 of the regular tests). This uncovered a fencepost error in the
 subtraction code, plus a double-rounding error in mpfr_float_backend (both
 also fixed).

 The main advantage of the new code is that it uses cpp_bin_float's
 existing rounding code to ensure a correct result, and is completely
 agnostic as to the widest integer size, or the size of the float being
 converted to. In trivial cases it basically degenerates to the same
 principle as yours - the temporary cpp_bin_float becomes a trivial wrapper
 around a single unsigned integer, and the bit-extraction loop executes
 just the once.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

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