This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/57994] Constant folding of infinity
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 28 Jul 2013 16:37:55 +0000
- Subject: [Bug tree-optimization/57994] Constant folding of infinity
- Auto-submitted: auto-generated
- References: <bug-57994-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57994
--- Comment #11 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Sat, 27 Jul 2013, glisse at gcc dot gnu.org wrote:
> 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.
Such comments must be understood to be written on the assumption that the
reader is familiar with the desired IEEE semantics - that is, that the
flags is raised if and only if a NaN argument is a signaling NaN (and such
arithmetic patterns on input NaNs, to ensure that "invalid" is raised if
either NaN is signaling, and otherwise that an input NaN's significand is
preserved, are very common in glibc).