Thread (5 messages) 5 messages, 3 authors, 2026-02-10

Re: floor/ceil man pages

From: Alejandro Colomar <alx@kernel.org>
Date: 2026-01-29 15:37:40

[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>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help