meaning of floating-point comparison operators
Richard Earnshaw
rearnsha@gcc.gnu.org
Thu Jan 27 12:44:00 GMT 2005
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
(UNORDERED OR ...)
Hope that helps.
R.
More information about the Gcc
mailing list