Bug 13787 - expm1 (1e5) does not raise OVERFLOW exception on x86
Summary: expm1 (1e5) 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-02-29 22:31 UTC by Joseph Myers
Modified: 2014-06-26 14:03 UTC (History)
0 users

See Also:
Host: i686-pc-linux-gnu
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-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).