FP comparisons, C, X86, and NaN's
Chris Lattner
sabre@nondot.org
Sun Jun 20 20:04:00 GMT 2004
On 18 Jun 2004, Gabriel Dos Reis wrote:
>
> | > > 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:
>
> No! That section explicitly says that isxxx type generic macros
> are _quiet_ in the sense that they *do not raise* floating-point
> exception or traps or whatever. It is not implementation defined. It
> is prescribed. Please consider the whole section I quoted.
I'm sorry, I meant standard relational operators like < and >. The
behavior of the isxxx macros are quite clear. Is it undefined whether or
not the <,> operators trap? (I'm guessing no from your later response)
> | > -- 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.
>
> "Relation operators" in the above quote means the usual <, >, <=, >=,
> ==, !=. Not the isgreater, isxxxx... type generic macros.
>
> Said differently, you've discovered a bug in the code GCC generates.
>From this, I take it to mean that < is defined to trap if either operand
is a QNaN or SNaN. Is this what you mean?
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/
More information about the Gcc
mailing list