Groups | Search | Server Info | Login | Register


Groups > gnu.g++.bug > #1

Error Report

From Juergen Sauermann <juergen.sauermann@t-online.de>
Newsgroups gnu.g++.bug
Subject Error Report
Date 2016-04-16 18:05 +0200
Message-ID <mailman.536.1460830706.7477.bug-gplusplus@gnu.org> (permalink)

Show all headers | View raw


Hi,

I habe received the error report below on the bug-apl mailing list.

But the problem seems to be with the g++ compiler.

The effect is that -8 to the 1/3-power (= cubic root of -8) gives the
correct result when compiled with -O2, but 0 with -O5.

See http://lists.gnu.org/archive/html/bug-apl/2016-04/index.html for the 
entire thread.

Best Regards,
Jürgen Sauermann

> On Apr 13, 2016, at 7:03 PM, Kacper Gutowski<mwgamera@gmail.com>  wrote:
>
> On Thu, Apr 14, 2016 at 1:54 AM, Xiao-Yong Jin wrote:
>> Exactly so.  ‘-Ofast -fno-finite-math-only’ gives correct results.
>> What’s going on here?  I don’t expect this has anything to do with NaN or Inf.
> pow(-8., 1./3) is nan.
> And -ffinite-math-only eliminates isfinite check at FloatCell.cc:422.

That explains it.  Thanks.

Here is some amusement:

g++ -Ofast -fno-unsafe-math-optimizations:
     pow(-8., 1./3.)  =>  nan
     isfinite         =>  1

g++ -Ofast -fno-unsafe-math-optimizations -fno-finite-math-only:
     pow(-8., 1./3.)  =>  nan
     isfinite         =>  0

g++ -Ofast -fno-finite-math-only:
     pow(-8., 1./3.)  =>  -2
     isfinite         =>  1

clang++ -march=native -Ofast:
     pow(-8., 1./3.)  =>  nan
     isfinite         =>  0


Back to gnu.g++.bug | Next | Find similar


Thread

Error Report Juergen Sauermann <juergen.sauermann@t-online.de> - 2016-04-16 18:05 +0200

csiph-web