This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: meaning of floating-point comparison operators
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: Miles Bader <miles at gnu dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 27 Jan 2005 09:56:35 +0000
- Subject: Re: meaning of floating-point comparison operators
- Organization: GNU
- References: <buod5vrp7ov.fsf@mctpc71.ucom.lsi.nec.co.jp>
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.