Re: nextafter underflow and errno in Glibc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Pascal,

On 3/8/23 19:10, Pascal Cuoq wrote:
> Hello,
> 
> in 2008 Michael Kerrisk reported that Glibc's nextafter implementation did not set errno as it should:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=6799
> 
> That bug was marked as “RESOLVED FIXED” in 2020 but there still exists a disagreement between what the current man page for nextafter at https://man7.org/linux/man-pages/man3/nextafter.3.html says, namely:
> 
>        If x is not equal to y, and the correct function result would be
>        subnormal, zero, or underflow, a range error occurs, and either
>        the correct value (if it can be represented), or 0.0, is
>        returned.
>
>        Range error: result is subnormal or underflows
>               errno is set to ERANGE.  An underflow floating-point
>               exception (FE_UNDERFLOW) is raised.
> 
> … and what Glibc's implementation does for nextafter(0., 1.).
> 
> This has been reported by myself in January of 2023:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=30040
> 
> As of this writing, the Glibc maintainers' stance appears to be that this behavior is intentional because the specification that Glibc intends to implement only mandates setting errno when the result is zero, and apparently allows setting it or not when the result is 0x1.0p-1074, depending on whether this value was obtained by going one step up from 0.0 or one step down from 0x2.0p-1074.
> 
> If the Glibc maintainers do not consider the current behavior a bug, then this should be noted somehow in the nextafter man page.

Would you please send a patch for the manual page?  You can
find the guidelines for that here:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING>.

You can clone the git repository from here:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/>

If you send a patch, please CC the folowing:
Cc: Andreas Schwab <schwab@xxxxxxxxxxxxxx>
Cc: <libc-alpha@xxxxxxxxxxxxxx>

Thanks,

Alex

> 
> Regards,
> 
> Pascal
> 

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux