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: meaning of floating-point comparison operators

On Thu, 2005-01-27 at 09:01, Miles Bader wrote:

> The UN* operators, ORDERED, and UNORDERED, have obvious meaning, but
> are the other ("normal") operators supposed to be equivalent to
> "ORDERED && ...", or are they supposed to signal an exception if the
> operands aren't ordered?
> The reason I ask is because the machine I'm porting to offers
> "ORDERED && ..." tests, "UNORDERED || ..." tests, and "signal if not
> ordered" tests.
> If the meaning is indeed "ORDERED && ...", NE would be synonymous
> with LTGT, which makes me suspect that's not the case, but the way
> that `reverse_condition_maybe_unordered' works (it reverses the
> operators as if that _were_ the meaning) makes me wonder.

GCC interprets the predicates as follows for floating point values,
where '?' represents UNORDERED.

Comparison        (IEEE Op)      Inverse    (IEEE Op)

EQ                =              NE         ?<>
LTGT              <>             UNEQ       ?=
LE                <=             UNGT       ?>
LT                <              UNGE       ?>=
GE                >=             UNLT       ?<
GT                >              UNLE       ?<=
ORDERED           <=>            UNORDERED  ?

The column on the left is always (ORDERED AND ...), that on the right

Hope that helps.


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