optimization/520: exp function can't handle -inf in optimized mode on i686

karsten.trulsen@math.sintef.no karsten.trulsen@math.sintef.no
Mon Sep 11 00:36:00 GMT 2000


>Number:         520
>Category:       optimization
>Synopsis:       exp function can't handle -inf in optimized mode on i686
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 11 00:36:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Karsten Trulsen
>Release:        gcc-2.95.2
>Organization:
>Environment:
i686 RedHat 6.2
>Description:
exp(-inf) should return 0.  However, when compiled with
optimization turned on, on a i686 (running RedHat 6.2),
the return value is "nan".
>How-To-Repeat:
#include <math.h>
#include <stdio.h>

int
main (void)
{
  double x = 0;
  printf ("%g\n", x);
  x = log (x);
  printf ("%g\n", x);
  x = exp (x);
  printf ("%g\n", x);
  return 1;
}
>Fix:
The error is probably in the assembly code in the file
/usr/include/bits/mathinlines.h.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-bugs mailing list