Bug 164154 - gcc floating point has problems when -O according to paranoia.c
gcc floating point has problems when -O according to paranoia.c
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2005-07-25 09:45 EDT by gpk
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-07-25 17:34:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 323 None None None Never

  None (edit)
Description gpk 2005-07-25 09:45:42 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616

Description of problem:
Running paranoia.c (a standard floating point test program),
compiled with optimization, reports many flaws and defects.

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

How reproducible:

Steps to Reproduce:
1. Download from http://www.netlib.org/paranoia/paranoia.c
2. gcc -O -o paranoia paranoia.c -lm
3. ./paranoia

Actual Results:  Much explanatory text, then:

Searching for Radix and Precision.
Radix = 2.000000 .
Closest relative separation found is U1 = 5.4210109e-20 .
Recalculating radix and precision
 gets better closest relative separation U1 = 9.2157185e-18 .
MYSTERY: recalculated Radix = 0.0000000e+00 .
FLAW:  Radix is not as good as 2 or 10.
FAILURE:  (1-U1)-1/2 < 1/2 is FALSE, prog. fails?.
The number of significant digits of the Radix is 0.000000 .
FAILURE:  Precision test appears to be inconsistent...
        U1 = 9.2157185e-18, Z1 - U1 = -9.1615084e-18
        U2 = 1.0842022e-19, Z2 - U2 = 0.0000000e+00

Checking for guard digit in *, /, and -.
SERIOUS DEFECT:  Division lacks a Guard Digit, so X/1 != X.
FAILURE:  * and/or / gets too many last digits wrong.
SERIOUS DEFECT:  - lacks Guard Digit, so cancellation is obscured.

Expected Results:  Much explanatory text without the DEFECT warnings,
or the appeak to KARPINSKI.

Additional info:

Similar problems were seen on a Debian system, using gcc3.3,
so I'm pretty sure it's not a hardware problem.
Comment 1 Jakub Jelinek 2005-07-25 17:34:14 EDT
paranoia.c relies on no excess precision computation.  So, on IA-32 because
of its misdesigned FPU, you either need to use -ffloat-store (which is slow,
but more standard conforming (though still not fully, see GCC PR323), or, if you
have SSE2 support in hardware, -msse2 -mfpmath=sse.

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