Section: 28.7.3 [c.math.hypot3] Status: New Submitter: Matthias Kretz Opened: 2018-12-06 Last modified: 2018-12-21 15:26:00 UTC
View all issues with New status.
The 2-arg hypot function specified in the C standard is required to avoid overflow and underflow (220.127.116.11 p2). Furthermore C's Annex F (IEC 60559 floating-point arithmetic) defines special cases for inputs of ±0 and ±inf (F. 10.4.3). The 3-arg hypot function 28.7.3 [c.math.hypot3] is only specified as "Returns: .". This is inconsistent with the 2-arg overload.It is not clear whether C's Annex F is "imported" into the C++ standard. [cmath.syn] p1 suggests that it is: "The contents and meaning of the header <cmath> are the same as the C standard library header <math.h>, […]".
[2018-12-21 Reflector prioritization]
Set Priority to 3
This wording is relative to N4778.
[Drafting Note: Two mutually exclusive options are prepared, depicted below by Option A and Option B, respectively.]
Modify 28.7.3 [c.math.hypot3] as indicated:
float hypot(float x, float y, float z); double hypot(double x, double y, double z); long double hypot(long double x, long double y, long double z);
-1- Returns: .
Add a note that clarifies that the behavior of the 3-arg hypot function differs from the C specification. I.e. that no special guarantees wrt. over-/underflow or special values are given.