This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: weird optimization in sin+cos, x86 backend


On 02/14/2012 08:26 AM, Vincent Lefevre wrote:
On 2012-02-14 09:51:28 +0000, Andrew Haley wrote:
On 02/13/2012 08:00 PM, Geert Bosch wrote:
GNU Linux is quite good, but has issues with the "pow" function for
large exponents, even in current versions
Really?  Even on 64-bit?  I know this is a problem for the 32-bit
legacy architecture, but I thought the 64-bit pow() was OK.
According to http://sourceware.org/bugzilla/show_bug.cgi?id=706
the 32-bit pow() can be completely wrong, and the 64-bit pow()
is just very inaccurate.

That bugzilla brings up paranoia, but with gfortran 4.7 on glibc 2.12 I get
....
TESTING X**((X+1)/(X-1))  VS.  EXP(2) =   7.3890561      AS  X -> 1.
 ACCURACY SEEMS ADEQUATE.
 TESTING POWERS Z**Q  AT FOUR NEARLY EXTREME VALUES:
  NO DISCREPANCIES FOUND.
.....
NO FAILURES, DEFECTS NOR FLAWS HAVE BEEN DISCOVERED.
 ROUNDING APPEARS TO CONFORM TO THE PROPOSED IEEE STANDARD  P754
 THE ARITHMETIC DIAGNOSED APPEARS TO BE EXCELLENT!

Historically, glibc for i386 used the raw x87 built-ins without any of the recommended precautions. Paranoia still shows, as it always did:
TESTING X**((X+1)/(X-1)) VS. EXP(2) = 7.3890561 AS X -> 1.
DEFECT: Calculated (1-0.11102230E-15)**(-0.18014399E+17)
differs from correct value by -0.34413050E-08
This much error may spoil calculations such as compounded interest.
....


--
Tim Prince


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]