public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/57994] Constant folding of infinity Date: Sat, 27 Jul 2013 20:31:00 -0000 [thread overview] Message-ID: <bug-57994-4-4Z0AGUfQDL@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-57994-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57994 --- Comment #9 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to joseph@codesourcery.com from comment #7) > An example of MPC not following all the Annex G special cases is that > catanh (1 + i0) is specified in Annex G to return Inf + i0 with > divide-by-zero exception, but at least with my MPC installation it returns > Inf + iNaN. I haven't tried to check how MPFR handles special cases; the > issue with MPC is simply something I noticed incidentally while fixing > glibc libm handling of various <complex.h> functions. Thanks (I assume you reported it to MPC, so that will be one fewer issue in a few years :-). I believe there are far fewer special cases (and thus risks) with MPFR, but that would indeed require a suitable testsuite for all functions for which we enable it (at least if MPFR doesn't already have such a testsuite, and maybe even then, to make sure we call it properly). > > I was wondering about that last point. Couldn't we replace: > > > > x=sin(Inf); > > > > with: > > > > x=NaN; > > errno=EDOM; // only if flag_math_errno > > errno is typically a macro.... That's why I was mentioning front-end help... There should be ways to set errno to EDOM faster than calling sin(Inf). > > volatile double f=NaN+NaN; // if flag_trapping_math, something to raise invalid > > (make sure we don't recursively try to propagate the constant there, so maybe > > the NaN argument should be volatile) > > I think you mean 0.0 / 0.0 or Inf - Inf or similar; NaN+NaN doesn't raise > an exception if the NaNs are quiet NaNs. Yeah, any of those. I was inspired by glibc, which has for instance: double __fdim (double x, double y) { int clsx = fpclassify (x); int clsy = fpclassify (y); if (clsx == FP_NAN || clsy == FP_NAN || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE)) /* Raise invalid flag. */ return x - y; which looks like it expects QNaN-QNaN to set the invalid flag.
next prev parent reply other threads:[~2013-07-27 20:31 UTC|newest] Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-07-26 15:13 [Bug tree-optimization/57994] New: " glisse at gcc dot gnu.org 2013-07-26 15:16 ` [Bug tree-optimization/57994] " paolo.carlini at oracle dot com 2013-07-26 21:53 ` joseph at codesourcery dot com 2013-07-27 0:15 ` paolo.carlini at oracle dot com 2013-07-27 19:53 ` paolo.carlini at oracle dot com 2013-07-27 20:10 ` joseph at codesourcery dot com 2013-07-27 20:10 ` glisse at gcc dot gnu.org 2013-07-27 20:26 ` paolo.carlini at oracle dot com 2013-07-27 20:31 ` glisse at gcc dot gnu.org [this message] 2013-07-27 20:46 ` paolo.carlini at oracle dot com 2013-07-28 16:38 ` joseph at codesourcery dot com 2013-07-28 17:40 ` vincent-gcc at vinc17 dot net 2013-08-01 20:55 ` vincent-gcc at vinc17 dot net 2013-08-02 23:23 ` paolo.carlini at oracle dot com 2013-08-27 17:34 ` vincent-gcc at vinc17 dot net 2013-10-24 12:27 ` paolo.carlini at oracle dot com 2013-10-24 12:35 ` paolo.carlini at oracle dot com 2013-10-24 12:40 ` paolo.carlini at oracle dot com 2013-10-24 13:01 ` paolo.carlini at oracle dot com 2013-10-24 13:08 ` paolo.carlini at oracle dot com 2013-10-24 15:29 ` vincent-gcc at vinc17 dot net 2013-10-24 15:42 ` vincent-gcc at vinc17 dot net 2013-10-24 15:51 ` paolo.carlini at oracle dot com 2014-04-22 11:36 ` jakub at gcc dot gnu.org 2014-07-16 13:29 ` jakub at gcc dot gnu.org 2014-10-30 10:43 ` jakub at gcc dot gnu.org 2015-06-26 20:07 ` jakub at gcc dot gnu.org 2015-06-26 20:35 ` jakub at gcc dot gnu.org 2015-06-26 21:20 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-57994-4-4Z0AGUfQDL@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).