Bug 13787

Summary: expm1 (1e5) does not raise OVERFLOW exception on x86
Product: glibc Reporter: Joseph Myers <jsm28>
Component: mathAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal Flags: fweimer: security-
Priority: P2    
Version: 2.15   
Target Milestone: ---   
Host: i686-pc-linux-gnu Target:
Build: Last reconfirmed:

Description Joseph Myers 2012-02-29 22:31:57 UTC
On x86, expm1 (1e5) properly returns an infinity with errno set to ERANGE - but does not raise the OVERFLOW exception.  On x86_64, OVERFLOW is properly raised.

Testcase:

#include <errno.h>
#include <fenv.h>
#include <math.h>
#include <stdio.h>
#include <float.h>

volatile double d = 1e5;

int
main (void)
{
  feclearexcept (FE_ALL_EXCEPT);
  errno = 0;
  volatile double r = expm1 (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;
}

Result:

inf Numerical result out of range
Comment 1 Joseph Myers 2012-05-05 19:45:24 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).