On Thu, 9 Nov 2017, Hal Finkel wrote:

> Thus, neither cabs, nor most other math.h/complex.h functions taking
> floating-point inputs and producing a floating-point output, should ever
> formally overflow (because even infinity lies within the represented set), and
> so shouldn't set ERANGE (regardless of math_errhandling).

No.  When infinity is within the represented set, the "not in the range of 
representable values for its type" of 6.5p5 cannot occur and so does not 
result in undefined behavior even in the absence of Annex F.  But overflow 
for math.h functions is defined differently; see 7.12.1p5: "if the 
magnitude of the mathematical result is finite but so large that the 
mathematical result cannot be represented without extraordinary roundoff 
error in an object of the specified type".  Note the "without 
extraordinary roundoff error" which doesn't appear in 6.5p5.  So ERANGE is 
still appropriate for such an overflow (and permitted but never required 
for complex.h functions where they overflow).

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to