On x86, expf (FLT_MAX) does not raise the OVERFLOW exception as it should. Testcase: #include <errno.h> #include <fenv.h> #include <math.h> #include <stdio.h> #include <float.h> volatile float d = FLT_MAX; int main (void) { feclearexcept (FE_ALL_EXCEPT); errno = 0; volatile float r = expf (d); if (fetestexcept (FE_DIVBYZERO)) printf ("DIVBYZERO "); if (fetestexcept (FE_INEXACT)) printf ("INEXACT "); if (fetestexcept (FE_INVALID)) printf ("INVALID "); if (fetestexcept (FE_OVERFLOW)) printf ("OVERFLOW "); if (fetestexcept (FE_UNDERFLOW)) printf ("UNDERFLOW "); printf ("%.18g %m\n", r); return 0; }
Likewise, exp (1e5) and expl (1e5) do not raise OVERFLOW either (exp (DBL_MAX) does, apparently through a side effect of the incorrect use of __kernel_standard_f discussed in bug 13705).
Fixed by: commit 41498f4db1ebfeb2fb76b9137cba38c20000f1d3 Author: Joseph Myers <joseph@codesourcery.com> Date: Sat May 5 19:37:39 2012 +0000 Fix missing exceptions from exp (bugs 13787, 13922, 14036).