Opened 10 years ago
Closed 10 years ago
#8065 closed Bugs (fixed)
Multiprecision rounding issue
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | multiprecision |
Version: | Boost 1.53.0 | Severity: | Problem |
Keywords: | multiprecision, round | Cc: | e_float@… |
Description
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.
Attachments (1)
Change History (4)
by , 10 years ago
Attachment: | MPRoundingBug.cpp added |
---|
comment:1 by , 10 years ago
Cc: | added; removed |
---|
Chris, can you take a look at this one?
Many thanks, John.