[ub:expr.mul.div.by.zero] Code comment does not agree with normative wording
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp, tex
- Domain
- documentation
Research direction
Start at the [ub:expr.mul.div.by.zero] example and compare its comment with the normative wording in [expr.mul]/4 and the note in [expr.pre]/4. Correct the example so its statement about floating-point division by zero agrees with those passages, then check the linked wording for consistency.
Written by the indexing model from the issue text.
Description
int main() { int x = 1 / 0; // undefined behavior, division by zero double d = 1.0 / 0.0; // undefined behavior on systems where the range of // representable values of double is [-max,+max], on systems where // representable values is [-inf,+inf] this would not be undefined behavior }
The normative wording is ([expr.mul]/4):
If the second operand of / or % is zero, the behavior is undefined ([ub:expr.mul.div.by.zero]).
That is, the behavior of 1.0 / 0.0 is undefined even on systems that have positive and negative infinity.
In addition, a note in [expr.pre]/4 (added by P3899R3 "Clarify the behavior of floating-point overflow") mentions:
If the operands are of a type that adheres to ISO/IEC 60559, division by zero is the only case where an arithmetic expression has undefined behavior ([expr.mul]).
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 17h 45m
- Merged PRs (30d)
- 34
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cplusplus/draft
-
P2-Bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
P2-Bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
certification
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
bisq-network/support#2181 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
tutorial updates Open
Difficulty 1/5 Under an hour Newbie friendliness 80/100
sveltejs/svelte.dev#2241 ·