From: Alejandro Colomar <alx@kernel.org>
To: Morten Welinder <mwelinder@gmail.com>, josmyers@redhat.com
Cc: linux-man@vger.kernel.org, libc-help@sourceware.org
Subject: Re: floor/ceil man pages
Date: Thu, 29 Jan 2026 16:37:36 +0100 [thread overview]
Message-ID: <aXt9Cad8zPxKEWHx@devuan> (raw)
In-Reply-To: <CANv4PNkbi35JzgKump4zdNSUEwSjCpS7pQLZ8LTm+kKZ_4vtyw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]
[TO += Joseph]
[CC += libc-help@]
Hi Morten, Joseph,
On 2026-01-28T09:51:47-0500, Morten Welinder wrote:
> I see two minor problems:
>
> "If x is integral, +0, -0, NaN, or infinite, x itself is returned." --
> this seems to suggest that NaN is passed through unchanged, i.e., the
> type and sign of the NaN is unchanged. Other references I can find
> suggest that the NaN details are not guaranted. See
> https://en.cppreference.com/w/c/numeric/math/floor.html, for example.
Would you mind quoting the specific text that you think suggests that?
I see in that page
If arg is NaN, NaN is returned.
> "ceil(-0.5) is 0.0". I can't find a reference, but (1) this looks
> weird, and (2) it looks like libc actually returns -0.0 which makes
> more sense. As noted above, ceil(-0.0) is required to be -0.0 if if
> ceil(-0.5) were to return +0.0 it would make ceil a non-monotonic
> function.
I have no idea. It doesn't seem to be specified by the standard.
Joseph, do you know if the floating-point group has talked anything
about this recently?
Have a lovely day!
Alex
>
> M.
>
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-01-29 15:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 14:51 floor/ceil man pages Morten Welinder
2026-01-29 15:37 ` Alejandro Colomar [this message]
2026-01-29 16:27 ` Joseph Myers
2026-01-29 18:08 ` Morten Welinder
2026-02-10 23:38 ` Alejandro Colomar
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=aXt9Cad8zPxKEWHx@devuan \
--to=alx@kernel.org \
--cc=josmyers@redhat.com \
--cc=libc-help@sourceware.org \
--cc=linux-man@vger.kernel.org \
--cc=mwelinder@gmail.com \
/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