On an underflow error, j0(), j1(), and jn() correctly set errno to ERANGE, but do not raise an IEEE exception. They should raise the FE_UNDERFLOW exception. Background: On error, many glibc math functions both set errno and raise an exception (fetestexcept(3)). For example, the following function all do this: acos(), asin(), cosh(), sinh(), acosh(), asinh(), exp(), exp2(), ldexp(), log(), log10(), log2(). However, there is much inconsistency. Some functions raise an exception, but don't set errno. Some functions set errno for some errors, but not others. A few set errno, but don't raise an exception. This series of bug reports documents deviations from what I consider the ideal: all functions should BOTH set errno AND raise an exception for all errors. All of these reports relate to tests on glibc 2.8 (as provided by SUSE 11.0).
Created attachment 2871 [details] test program
Created attachment 2872 [details] test program
Created attachment 2873 [details] test program Sample runs demonstrating the problem: $ /tmp/mt_j0 1e100 errno == ERANGE fetestexcept() says: FE_INEXACT j0(1.00000000000000002e+100)=0.00000000000000000e+00 ERANGE 0 +0 $ /tmp/mt_j1 1e100 errno == ERANGE fetestexcept() says: FE_INEXACT j1(1.00000000000000002e+100)=0.00000000000000000e+00 ERANGE 0 +0 $ /tmp/mt_jn 10 1e100 errno == ERANGE fetestexcept() says: FE_INEXACT jn(10,1.00000000000000002e+100)=0.00000000000000000e+00 ERANGE 0 +0
See http://sourceware.org/ml/libc-alpha/2012-02/msg00512.html - the correct result won't underflow in these cases but in whatever cases TLOSS errors are given I suppose underflow should be raised as well.
It's now documented that exceptions may not be raised when libm is in the (deprecated) error-handling modes that use matherr, which are the only cases where TLOSS errors may occur (since commit c36e1d2369f149a64c759f3ad6f4cc5a03b03b62).