Skip to content

Round a quotient of a non-default mode by its remainder - #1454

Open
ibmibmibm wants to merge 1 commit into
boostorg:developfrom
ibmibmibm:div-directed-rounding
Open

Round a quotient of a non-default mode by its remainder#1454
ibmibmibm wants to merge 1 commit into
boostorg:developfrom
ibmibmibm:div-directed-rounding

Conversation

@ibmibmibm

Copy link
Copy Markdown
Contributor
  • The divides of the non-default rounding modes dropped the remainder of the wide quotient
    before the constructor rounded it. A mode which must move away from the truncated
    quotient could not.
  • The 32 and 64 bit types held five or six digits past the precision, thus the defect
    showed only when all of them were zero. The 128 bit types held zero or one digit, thus
    most quotients were wrong, and fe_dec_to_nearest_from_zero was wrong too.
  • The remainder now goes in as one sticky digit after the wide quotient. The 128 bit
    divide also takes one digit more, thus the constructor has a quotient digit to round
    before the sticky digit.
  • Both operands of the 128 bit divide have 34 digits, thus the quotient has at most 37
    and the block for a wider quotient was dead. It went away.

Fixes #1453

- The divides of the non-default rounding modes dropped the remainder of the wide quotient
  before the constructor rounded it. A mode which must move away from the truncated
  quotient could not.
- The 32 and 64 bit types held five or six digits past the precision, thus the defect
  showed only when all of them were zero. The 128 bit types held zero or one digit, thus
  most quotients were wrong, and fe_dec_to_nearest_from_zero was wrong too.
- The remainder now goes in as one sticky digit after the wide quotient. The 128 bit
  divide also takes one digit more, thus the constructor has a quotient digit to round
  before the sticky digit.
- Both operands of the 128 bit divide have 34 digits, thus the quotient has at most 37
  and the block for a wider quotient was dead. It went away.

Fixes boostorg#1453
@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.5%. Comparing base (bad17ca) to head (34b1d05).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #1454     +/-   ##
=========================================
+ Coverage     98.4%   98.5%   +0.1%     
=========================================
  Files          300     301      +1     
  Lines        25188   25223     +35     
  Branches      2189    2189             
=========================================
+ Hits         24774   24832     +58     
+ Misses         414     391     -23     
Files with missing lines Coverage Δ
include/boost/decimal/detail/div_impl.hpp 91.7% <100.0%> (+11.9%) ⬆️
test/github_issue_1453.cpp 100.0% <100.0%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bad17ca...34b1d05. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ibmibmibm
ibmibmibm marked this pull request as ready for review September 14, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A divide under a non-default rounding mode drops the remainder of its quotient

1 participant