Bug 13922 - expf (FLT_MAX) does not raise overflow exception on x86
Summary: expf (FLT_MAX) does not raise overflow exception on x86
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.15
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-28 00:03 UTC by Joseph Myers
Modified: 2014-06-26 13:39 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Myers 2012-03-28 00:03:52 UTC
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;
}
Comment 1 Joseph Myers 2012-04-08 22:27:15 UTC
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).
Comment 2 Joseph Myers 2012-05-05 19:45:59 UTC
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).