From: Joseph Myers <josmyers@redhat.com>
To: Alejandro Colomar <alx@kernel.org>
Cc: Morten Welinder <mwelinder@gmail.com>,
linux-man@vger.kernel.org, libc-help@sourceware.org
Subject: Re: floor/ceil man pages
Date: Thu, 29 Jan 2026 16:27:04 +0000 (UTC) [thread overview]
Message-ID: <af74fa04-e25a-7300-bdc5-bd3092ecc3ff@redhat.com> (raw)
In-Reply-To: <aXt9Cad8zPxKEWHx@devuan>
On Thu, 29 Jan 2026, Alejandro Colomar wrote:
> > "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?
round, floor, ceil, trunc and roundeven (of non-NaN) always return a
result with the sign of their input, including when that result is zero.
This is not anything new.
--
Joseph S. Myers
josmyers@redhat.com
next prev parent reply other threads:[~2026-01-29 16:27 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
2026-01-29 16:27 ` Joseph Myers [this message]
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=af74fa04-e25a-7300-bdc5-bd3092ecc3ff@redhat.com \
--to=josmyers@redhat.com \
--cc=alx@kernel.org \
--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