[Boost-bugs] [Boost C++ Libraries] #13301: boost multiprecision conversion from binary float to int types fails for large floats

Subject: [Boost-bugs] [Boost C++ Libraries] #13301: boost multiprecision conversion from binary float to int types fails for large floats
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-11-18 07:15:16


#13301: boost multiprecision conversion from binary float to int types fails for
large floats
------------------------------+----------------------------
 Reporter: marc.alexa@… | Owner: John Maddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
  Version: Boost 1.64.0 | Severity: Problem
 Keywords: |
------------------------------+----------------------------
 It appears the conversion from binary float types such as

 {{{
 typedef number<cpp_bin_float<8,backends::digit_base_2> > quarter_float;
 }}}

 to integer types fails if the float is 2^8^ or larger. For example, using

 {{{
 quarter_float qf(256);
 cpp_int i = qf.convert_to<cpp_int>();
 unsigned int n = qf.convert_to<unsigned int>();
 }}}

 I get 0 for i and 4294967295 for n.

 A try to attach a full code example.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13301>
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-11-18 07:21:15 UTC