This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/57994] Constant folding of infinity


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).


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