Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail From: Juergen Sauermann Newsgroups: gnu.g++.bug Subject: Error Report Date: Sat, 16 Apr 2016 18:05:12 +0200 Lines: 48 Approved: bug-gplusplus@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1460830706 8196 208.118.235.17 (16 Apr 2016 18:18:26 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-gplusplus@gnu.org Envelope-to: bug-gplusplus@gnu.org User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 X-ID: XZJ9hrZSoh-pLtbyTPsRPcCigTx2Nv-4ut+u6cxazmJ5mNgRztgkUpsG8kueaJGZs+ X-TOI-MSGID: 704596cb-0579-4611-b5e5-dd98391e3ceb X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 194.25.134.20 X-Mailman-Approved-At: Sat, 16 Apr 2016 14:18:25 -0400 X-BeenThere: bug-gplusplus@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU C++ compiler List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.g++.bug:1 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 (=3D 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=20 entire thread. Best Regards, J=C3=BCrgen Sauermann > On Apr 13, 2016, at 7:03 PM, Kacper Gutowski wrote= : > > On Thu, Apr 14, 2016 at 1:54 AM, Xiao-Yong Jin wrote: >> Exactly so. =E2=80=98-Ofast -fno-finite-math-only=E2=80=99 gives corr= ect results. >> What=E2=80=99s going on here? I don=E2=80=99t expect this has anythin= g 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.) =3D> nan isfinite =3D> 1 g++ -Ofast -fno-unsafe-math-optimizations -fno-finite-math-only: pow(-8., 1./3.) =3D> nan isfinite =3D> 0 g++ -Ofast -fno-finite-math-only: pow(-8., 1./3.) =3D> -2 isfinite =3D> 1 clang++ -march=3Dnative -Ofast: pow(-8., 1./3.) =3D> nan isfinite =3D> 0