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...
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc   
(Show other bugs)
Version: 2
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
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:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-01 10:15:12 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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.