[cfp-interest 3456] Re: nexttoward
LNT
lntue.h at gmail.com
Wed May 14 08:29:14 PDT 2025
Sorry for a late reply / update about nexttoward / nextafter issue with
underflow exceptions.
On the latest draft of C2y, section 7.12.2.7 about underflow is as follow:
The result underflows if a nonzero result value with ordinary accuracy
would have magnitude (absolute value) less than the minimum normalized
number in the type;
however a zero result that is specified to be an exact zero does not
underflow. Also, a result with ordinary accuracy and the magnitude of the
minimum normalized number may underflow.274)
If the result underflows, the function returns an implementation-defined
value whose magnitude is no greater than the smallest normalized positive
number in the specified type;
*if the integer expression math_errhandling & MATH_ERRNO is nonzero,
whether errno acquires the value ERANGE is implementation-defined;*
*if the integer expression math_errhandling & MATH_ERREXCEPT is nonzero,
whether the "underflow" floating-point exception is raised is
implementation-defined.*
So does it mean that the library implementation can choose to not raise the
floating point exceptions in this case (and document the decision) and
still conform to the standard?
Thanks,
Tue
On Tue, Mar 4, 2025 at 8:47 AM Vincent Lefevre <vincent at vinc17.net> wrote:
> On 2025-03-04 09:12:36 +0100, Paul Zimmermann wrote:
> > but there is no underflow requirement in 754-2008 nor in 754-2019
> > (where the only related functions are nextUp and nextDown).
>
> Indeed, the overflow/underflow/inexact exceptions for nextafter
> in 754-1985 were nonsense since there is no rounding (note that
> the "as if the exponent range were unbounded" cannot be used
> here, as nextafter would not return the expected result).
>
> --
> 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)
> _______________________________________________
> cfp-interest mailing list
> cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20250514/52e0cf1f/attachment.htm>
More information about the cfp-interest
mailing list