Bug 149986 - pow() crashes, and exp() gives negative results on certain operands when used in IEEE upward rounding mode
Summary: pow() crashes, and exp() gives negative results on certain operands when used...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 2
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-03-01 08:18 UTC by David Monniaux
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-03-01 10:15:12 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
first example (pow() crash) (270 bytes, text/plain)
2005-03-01 08:19 UTC, David Monniaux
no flags Details
exp() yields negative result (807 bytes, text/plain)
2005-03-01 08:20 UTC, David Monniaux
no flags Details

Description David Monniaux 2005-03-01 08:18:40 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.3) Gecko/20040913

Description of problem:
On AMD64: after a fesetround(FE_UPWARD) (ISO C99 standard function for changing IEEE arithmetics rounding mode to round-to-plus-infinity, i.e. round to the nearest greater or equal representable value), pow() on certain operands will result in a segmentation fault, and exp() on some operands will yield negative results (the exponential of a real number is never negative).

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

How reproducible:
Always

Steps to Reproduce:
1) x=79.252413924118542354335659183561801910400390625, y=0.333333299999999999041477849459624849259853363037109375
2) fesetround(FE_UPWARD);
3a) pow(x, y)
3b) exp(log(x)*y)
(see attachment)
  

Actual Results:  3a) Segmentation fault.
3b) result = -0.246008

Expected Results:  Both programs should have given something around 4.295405, as it happens on IA32.

Additional info:

The glibc code (e_pow.c) that is used for some computations states, in a comment:
"Assumption: Machine arithmetic operations are performed in round to nearest
mode of IEEE 754 standard."

The bug has been filed in glibc bugzilla (http://sources.redhat.com/bugzilla/show_bug.cgi?id=763).

This bug has resulted in annoying crashes in scientific code doing interval arithmetic.

Comment 1 David Monniaux 2005-03-01 08:19:32 UTC
Created attachment 111517 [details]
first example (pow() crash)

Comment 2 David Monniaux 2005-03-01 08:20:06 UTC
Created attachment 111518 [details]
exp() yields negative result

Comment 3 Jakub Jelinek 2005-03-01 10:15:12 UTC
There is no reason to duplicate the report here.
FYI, #1 certainly doesn't crash for me and #2 doesn't yield negative value.
This is with glibc-2.3.4-2.fc3.x86_64.rpm.
It doesn't yield 4.2954 though, but 8.02056.

Comment 4 David Monniaux 2005-03-01 10:50:09 UTC
The first definitely crashes on FC2. What does pow(x,y) give on FC3/x86_64?
(Note: exp() giving 8 instead of 4.2 seems like a wild result too...)


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