[cfp-interest 3556] Re: Overflow, non-default rounding, errno is what?
Vincent Lefevre
vincent at vinc17.net
Mon Aug 4 06:20:53 PDT 2025
On 2025-08-04 09:56:02 +1000, Fred J. Tydeman wrote:
> In reading 7.12.1 on "overflow", I do not see any words on what
> happens to errno on overflow in non-default rounding.
>
> Normally, if nothing is said, that means implicit Undefined Behaviour.
> I assume we would want implementation-defined behaviour or
> alter to ERANGE.
I don't think that this could be undefined behavior. 7.12.1 starts
with:
The behavior of each of the functions in <math.h> is specified
for all representable values of its input arguments, except
where explicitly stated otherwise.
So any undefined behavior would have to be explicit here.
For errno, if nothing is specified here under the considered
conditions, one would just get the default behavior for arbitrary
library functions, as specified in 7.5 "Errors <errno.h>":
The value of errno may be set to nonzero by a library function call
whether or not there is an error, provided the use of errno is not
documented in the description of the function in this document.
--
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
More information about the cfp-interest
mailing list