The posix reaminder() spec says:
If x or y is NaN, a NaN shall be returned.
If x is infinite or y is 0 and the other is non-NaN, a domain error shall occur,
and either a NaN (if supported), or an implementation-defined value shall be
On glibc 2.8, remainder(NaN, 0) gives a domain error (EDOM, FE_INVALID). As per
the above spec, it should return a NaN without error.
Created attachment 2844 [details]
Sample run showing problem:
$ /tmp/mt_remainder nan 0
errno == EDOM
fetestexcept() says: FE_INVALID
EDOM FE_INVALID nan
Thanks, patch send to libc-alpha mailinglist.
I've checked in the patch.
Documented for man-pages-4.09.