[Boost-bugs] [Boost C++ Libraries] #8065: Multiprecision rounding issue

Subject: [Boost-bugs] [Boost C++ Libraries] #8065: Multiprecision rounding issue
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-02-14 15:32:08


#8065: Multiprecision rounding issue
---------------------------------------------------------+------------------
 Reporter: Matthias Wagner <MWagner@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
  Version: Boost 1.53.0 | Severity: Problem
 Keywords: multiprecision, round |
---------------------------------------------------------+------------------
 When running the attached program, rounding issues occur. The program
 shifts a boost::multiprecision::cpp_dec_float<N>(1) by N digits left, then
 calls the round method and shifts back to the right. The round method
 fails to truncate the 0.5 it adds for some N. The issue becomes worse if
 you shift even further to the left or use a higher initial value. The
 problematic code seems to be in cpp_dec_float<>::extract_integer_part,
 which decides that no truncation is required, although the guard digits
 are not zero. For me, removing the whole else if (exp >=...) {} clause
 seemed to fix it.

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