For the pole error, POSIX.1 says of lgamma():
The x argument is a negative integer or zero.
If the integer expression (math_errhandling & MATH_ERRNO) is non-zero, then
errno shall be set to [ERANGE]. If the integer expression (math_errhandling &
MATH_ERREXCEPT) is non-zero, then the divide-by-zero floating-point exception
shall be raised.
glibc 2.8's lgamma() does raise the divide-by-zero exception, as expected.
It also sets errno, but to the wrong value: errno is set to EDOM, when it should
instead be ERANGE.
Created attachment 2842 [details]
Attached a test program. Sample run showing the problem:
$ /tmp/mt_lgamma -- -1
errno == EDOM
fetestexcept() says: FE_DIVBYZERO
EDOM FE_DIVBYZERO +inf
This bug appears to have been fixed in glibc 2.10, and man-pages-3.27 is updated