Skip to content

[expr.mul] Reword 'truncation towards zero' in footnote #6835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Eisenwave
Copy link
Member

Fixes #6790.

I agree with @Tevemadar; "truncation towards zero" sounds redundant. However, I have frequently heard

  • rounding towards zero
  • truncation

The new footnote mentions both.

@Eisenwave
Copy link
Member Author

I've made a few more changes, upon further thought:

  1. Our cleaner, modern way of wording rounding (e.g. https://eel.is/c++draft/expr.shift#3) is to say "rounded towards X".
    Saying "truncation towards zero" is redundant, and we don't need clarifying footnotes if we just word it properly.
  2. The following explanation of a / b = (a/b)*b + a%b is totally tutorial-like. That's simply a consequence of % being the remainder of the division with said rounding mode, as the paragraph states. It also adds no new information to say that the behavior is undefined if the result cannot be represented in the result type; that's a general rule for [expr]. I think it's best to just keep this wording in a note, even if it's giving the user a math tutorial and restating something broadly known. \ref{expr} may be helpful though, lemme add that.

@Eisenwave Eisenwave force-pushed the truncation-towards-zero branch from edfe321 to a4eae50 Compare July 18, 2025 09:01
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.

"truncation towards zero" could be "truncation"
1 participant