Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12327: cpp_rational::convert_to<double>() does not return the nearest number
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-07-14 17:00:01
#12327: cpp_rational::convert_to<double>() does not return the nearest number
-------------------------------+----------------------------
Reporter: komakisen@⦠| Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
Version: Boost 1.61.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------------
Comment (by johnmaddock):
I believe it's an error in your test program, taking the first example:
0.099999999999999992 = 7205759403792793/72057594037927936
0.10000000000000001 = 3602879701896397/36028797018963968
Note that these fractions are exact (in the binary, not decimal sense).
Then r112 becomes 5404319552844595/54043195528445952 which is
0.0999999999999999962992565845828115319212277730305989583... in decimal,
which rounds up to 0.10000000000000001 and not down to
0.099999999999999992 due to the "6" after the string of 9's.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12327#comment:1> 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:20 UTC