Submitter:Fred J. Tydeman
Document: WG14 N1941
Related: WG14 DR 409 and 473
After hearing comments from some implementors at the Oslo 2015 WG14 meeting with respect to Defect Report 473, I believe I now know why some vendors have "extra" range errors in the math library.
C11 has: 7.12.1 Treatment of error conditions
#4 Likewise, a range error occurs if the mathematical result of the function cannot be represented in an object of the specified type, due to extreme magnitude.
Paragraph 5 then gives the details on overflow, and paragraph 6 then gives the details on underflow.
That is, overflow or underflow implies range error. However, nothing in those words preclude other things causing a range error.
Now, consider a specific case, 188.8.131.52 The expm1 functions, which has in C11:
A range error occurs if x is too large.
They are reading that as:
For large arguments (of either sign), (independent of overflow) a range error (is required to) occur. That is, this is another reason for a range error (because the standard requires it).
So for them, all four of these cases are range errors:
I believe that the intent of the committee has always been for expm1:
Suggested Technical Corrigendum
Change 7.21.1#4 to:
Likewise, a range error occurs if and only if the mathematical result of the function cannot be represented in an object of the specified type, due to extreme magnitude.
And, perhaps, add a footnote along the lines of:
That means, range errors only occur if there is an overflow or underflow.