Sources Bugzilla – Bug 6778
expm1() raises bogus underflow exception for -large
Last modified: 2012-07-06 11:19:45 UTC
(glibc 2.8) When expm1(x) is given a large negative x value (e.g., in the range -1e5 through to -1e308), it correctly returns -1. However, it also raises an underflow exception. This is bogus. The result has not underflowed: the result is asymptotically close to 1 (not zero).
Created attachment 2843 [details] test program Example runs showing problem: $ /tmp/mt_expm1 -- -1e5 errno == 0 fetestexcept() says: FE_UNDERFLOW FE_INEXACT expm1(-1.00000000000000000e+05)=-1.00000000000000000e+00 0 FE_UNDERFLOW normal $ /tmp/mt_expm1 -- -1e308 errno == 0 fetestexcept() says: FE_UNDERFLOW FE_INEXACT expm1(-1.00000000000000001e+308)=-1.00000000000000000e+00 0 FE_UNDERFLOW normal
Confirmed on x86 with current sources. Does not appear on x86_64. This is a quality-of-implementation issue only, since C99 and C11 permit spurious underflow exceptions (as well as spurious inexact exceptions, and raising inexact even when the result is exact).
Fixed for 2.17 by: commit f17ac40d7cb8e8c462476b6ab703262f6b8f6da8 Author: Joseph Myers <joseph@codesourcery.com> Date: Fri Jul 6 11:17:41 2012 +0000 Fix expm1 spurious underflow exceptions (bug 6778).