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

Re: FP comparisons, C, X86, and NaN's

On Sun, 20 Jun 2004, Gabriel Dos Reis wrote:

> > I'm trying to understand the standards relating to floating point
> > comparisons in C, particularly with respect to NaN's.  From my
> > interpretation of the whole mess, in C99, standard relational operations
> > (like X < Y) should trap on NaN's, including SNaNs.
> QNaNs don't trap, but would obey non-standard logic.  SNaNs would
> trap.  More specifically, the C99 standard says:

That is an interesting section, thanks for pointing it out.

> > 2. C does not define whether or not standard relational operations trap.
> >    If this is the case, there is no bug in GCC.

So you are saying that this is the case: it is undefined whether an
implementation traps on a comparison with nans?  This is my interpretation
of this passage:

>         --   is  true.   Relational   operators   may   raise   the
>        ``invalid''  floating-point  exception  when argument values
>        are NaNs.

I just want to make sure that I'm intepreting things correctly.

Thanks for the input!



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