Re: [Boost-bugs] [Boost C++ Libraries] #10082: implicit cpp_rational(double)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10082: implicit cpp_rational(double)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-30 18:07:28


#10082: implicit cpp_rational(double)
-------------------------------+----------------------------
  Reporter: marc.glisse@… | Owner: johnmaddock
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: multiprecision
   Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------------

Comment (by johnmaddock):

 Ugh, I'm a bit conflicted by this: you're quite right that the double
 value is converted exactly, however making this implicit does allow you to
 shoot yourself in the foot, for example:

 {{{
 cpp_rational r(0.1);
 }}}

 Assigns the value 3602879701896397/36028797018963968 to r, which is
 probably not what was intended! Of course a naive user may just add the
 necessary cast and shoot themselves anyway, but on balance I think I'm
 marginally against making the conversion implicit.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10082#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:16 UTC