floor/ceil man pages

Morten Welinder mwelinder@gmail.com
Thu Jan 29 18:08:43 GMT 2026


For NaN, it comes down to the ieee spec.  Ieee-754-2008 in Section 6.3
specifies that the only operations delivering a defined sign for NaNs
are: copy, abs, negate, and copysign.  "For all other operations, this
standard does not specify the sign bit of a NaN result, even when
there is only one input NaN, or when the NaN is produced from an
invalid operation."

The glibc people have in the past defended the freedom to return
whatever sign on NaN they feel like.  See
https://sourceware.org/bugzilla/show_bug.cgi?id=31104 for an example
where float/double/long double versions of various functions disagree
on what sign to return for NaN.

I don't think the man page should promise more than some standard
requires unless the implementation is specifically offering further
guarantees.

M.


More information about the Libc-help mailing list