<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">If the library implementation does not claim conformance to Annex F it can choose to not report an underflow range error, even if <font face="Courier New">math_errhandling & MATH_ERREXCEPT</font> is nonzero. This means the (non-Annex F) implementation can choose to not raise the floating-point exceptions in these cases.<div><br></div><div>However, Annex F conformance requires the floating-point exceptions in these cases. F.10.9.3 says</div><div><br></div><div>— <font face="Courier New">nextafter(</font><i>x</i><font face="Courier New">, </font><i>y</i><font face="Courier New">)</font> raises the "underflow" and "inexact" floating-point exceptions for the function value subnormal or zero and <i>x</i> ≠ <i>y</i>.</div><div><br></div><div>Annex F took this spec from IEEE 754-1985 and retains it as a legacy feature though revisions of IEEE 754 do not include the <font face="Courier New">nextafter</font> functions.</div><div><br></div><div>- Jim Thomas<br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On May 14, 2025, at 8:29 AM, LNT <lntue.h@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr">Sorry for a late reply / update about nexttoward / nextafter issue with underflow exceptions.<div><br></div><div>On the latest draft of C2y, section 7.12.2.7 about underflow is as follow:</div><div><br></div><div><div>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;</div><div>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)</div><div>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;</div><div><b><i><font color="#ff0000">if the integer expression math_errhandling & MATH_ERRNO is nonzero, whether errno acquires the value ERANGE is implementation-defined;</font></i></b></div><div><b><i><font color="#ff0000">if the integer expression math_errhandling & MATH_ERREXCEPT is nonzero, whether the "underflow" floating-point exception is raised is implementation-defined.</font></i></b></div><br></div><div>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?</div><div><br></div><div>Thanks,</div><div> Tue</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 4, 2025 at 8:47 AM Vincent Lefevre <<a href="mailto:vincent@vinc17.net" target="_blank">vincent@vinc17.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2025-03-04 09:12:36 +0100, Paul Zimmermann wrote:<br>
> but there is no underflow requirement in 754-2008 nor in 754-2019<br>
> (where the only related functions are nextUp and nextDown).<br>
<br>
Indeed, the overflow/underflow/inexact exceptions for nextafter<br>
in 754-1985 were nonsense since there is no rounding (note that<br>
the "as if the exponent range were unbounded" cannot be used<br>
here, as nextafter would not return the expected result).<br>
<br>
-- <br>
Vincent Lefèvre <<a href="mailto:vincent@vinc17.net" target="_blank">vincent@vinc17.net</a>> - Web: <<a href="https://www.vinc17.net/" rel="noreferrer" target="_blank">https://www.vinc17.net/</a>><br>
100% accessible validated (X)HTML - Blog: <<a href="https://www.vinc17.net/blog/" rel="noreferrer" target="_blank">https://www.vinc17.net/blog/</a>><br>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)<br>
_______________________________________________<br>
cfp-interest mailing list<br>
<a href="mailto:cfp-interest@oakapple.net" target="_blank">cfp-interest@oakapple.net</a><br>
<a href="http://mailman.oakapple.net/mailman/listinfo/cfp-interest" rel="noreferrer" target="_blank">http://mailman.oakapple.net/mailman/listinfo/cfp-interest</a><br>
</blockquote></div>
_______________________________________________<br>cfp-interest mailing list<br>cfp-interest@oakapple.net<br>http://mailman.oakapple.net/mailman/listinfo/cfp-interest<br></div></blockquote></div><br></div></body></html>