You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ub:expr.mul.div.by.zero] Code comment does not agree with normative wording #9341
intmain() {
int x = 1 / 0; // undefined behavior, division by zerodouble 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
}
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]).
Activity
eisenwave commentedon Sep 21, 2026
Fixed by: