🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1611

Re: STL operators != > <= >=

#1611
From: mfinney
Date: Sat, 05 Aug 1995 04:53
25 lines
1709 bytes
In <3vtcha$cbv@lyman.pppl.gov>, Etay Bogner <ebogner@ird.scitex.com> writes:
>I guess that the right way is to use solution "b".
>
>I'm saying this because I can't imagine why the results will be incorrect.
>
>For example, you defined operator< and operator==. Since I'm sure you did 
>your best, I can't see why the inline template function which is invoked for 
>"a operator> b", which produces "b operator< a", is incorrect ...

The problem is not defined < in terms of > or vice versa, but defined <= in
terms of >.  In a linear order there are three possibilities, a < b, a = b or a > b.
In a partial order there are four possibilities, a < b, a = b, a > b or a >< b (using
operator >< () mean "not comparable).

For a linear order, a <= b is equivalent to not (a > b).  However, that fails to
be true for a partial order because there is an extra possiblity.

If <= were defined in terms of > (or >= in terms of <) for IEEE floating point
then even there there would be a problem because there are NaNs (not a number)
objects in IEEE floating point which are not comparable to anything else,
including other NaNs.

This is why the definitions are wrong.

Michael Lee Finney
Technical Details
Message-ID: <3vutg6$713@mujibur.inmind.com>
Path: arc1-ca.pugleaf.net!mujibur.inmind.com!usenet
References: <3vpmv5$4t7@mujibur.inmind.com> <3vpnrq$50c@mujibur.inmind.com> <3vq030$8v1@lyman.pppl.gov> <3vs00b$4bf@mujibur.inmind.com> <3vtcha$cbv@lyman.pppl.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mujibur.inmind.com!usenet
From: mfinney@inmind.com
Newsgroups: comp.std.c++
Subject: Re: STL operators != > <= >=
Date: 5 Aug 1995 04:53:26 GMT
Organization: In Mind, Inc.
Message-ID: <3vutg6$713@mujibur.inmind.com>
References: <3vpmv5$4t7@mujibur.inmind.com> <3vpnrq$50c@mujibur.inmind.com> <3vq030$8v1@lyman.pppl.gov> <3vs00b$4bf@mujibur.inmind.com> <3vtcha$cbv@lyman.pppl.gov>
Reply-To: mfinney@inmind.com
NNTP-Posting-Host: finneyman.inmind.com
X-Newsreader: IBM NewsReader/2 v1.2