Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 111220 - exp function from math lib returns wrong values
exp function from math lib returns wrong values
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2003-11-30 07:29 EST by Edward Pilipczuk
Modified: 2016-11-24 10:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-11-30 08:30:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Edward Pilipczuk 2003-11-30 07:29:31 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1)

Description of problem:
as in summary -> small example test:
#include <stdio.h>
  int i;
    printf( "exp(%f)=%e ?\n", 1.0*i, exp( 1.0*i ) );
compiled with command 'gcc -O2 -lm -otest test.c'
produces for example such results...
exp(0.000000)=2.057234e+10 ?
exp(1.000000)=2.057234e+10 ?
exp(2.000000)=2.057234e+10 ?
exp(3.000000)=2.057234e+10 ?
exp(4.000000)=2.057234e+10 ?
exp(5.000000)=2.057234e+10 ?
exp(6.000000)=2.057234e+10 ?
exp(7.000000)=2.057234e+10 ?
exp(8.000000)=2.057234e+10 ?
exp(9.000000)=2.057234e+10 ?

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:  as in description

Actual Results:  as in description

Expected Results:  it is the lates glibc patch for RH9
I think new one is required that will have at least math revised...

Additional info:
Comment 1 Jakub Jelinek 2003-11-30 08:30:37 EST
This is a bug in the example.  Functions without prototypes are assumed
to return int.  exp returns double, not int, so this really cannot
work correctly, especially on architectures which return floating point
values in different registers than integral ones.
If you add #include <math.h> to the example, it will work just fine.

Note You need to log in before you can comment on or make changes to this bug.