Bug 111220 - exp function from math lib returns wrong values
exp function from math lib returns wrong values
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
9
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2003-11-30 08:30:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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)
Gecko/20030225

Description of problem:
as in summary -> small example test:
----
#include <stdio.h>
main(){
  int i;
  for(i=0;i<10;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):
  glibc-2.3.2-27.9.7

How reproducible:
Always

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.