public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: Pascal Cuoq <cuoq@trust-in-soft.com>,
	"mtk.manpages@gmail.com" <mtk.manpages@gmail.com>
Cc: "linux-man@vger.kernel.org" <linux-man@vger.kernel.org>,
	Guillaume Cluzel <guillaume.cluzel@trust-in-soft.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: nextafter underflow and errno in Glibc
Date: Fri, 10 Mar 2023 01:51:33 +0100	[thread overview]
Message-ID: <9f678634-d89c-c6fa-f06c-fbee8c5960bf@gmail.com> (raw)
In-Reply-To: <PR0P264MB07942F010016373449ED98D6C0B49@PR0P264MB0794.FRAP264.PROD.OUTLOOK.COM>


[-- Attachment #1.1: Type: text/plain, Size: 2190 bytes --]

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@linux-m68k.org>
Cc: <libc-alpha@sourceware.org>

Thanks,

Alex

> 
> Regards,
> 
> Pascal
> 

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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

       reply	other threads:[~2023-03-10  0:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <PR0P264MB07942F010016373449ED98D6C0B49@PR0P264MB0794.FRAP264.PROD.OUTLOOK.COM>
2023-03-10  0:51 ` Alejandro Colomar [this message]
2023-03-10  7:34 Pascal Cuoq
2023-03-10  8:31 ` Xi Ruoyao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f678634-d89c-c6fa-f06c-fbee8c5960bf@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=cuoq@trust-in-soft.com \
    --cc=guillaume.cluzel@trust-in-soft.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).