🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: STL operators != > <= >=

#1681
From: mfinney
Date: Wed, 09 Aug 1995 04:08
20 lines
1765 bytes
In <408o8u$c0p@hermes.synopsys.com>, Mike Chapman <mchapman@synopsys.com> writes:
>mfinney@inmind.com wrote:
>I disagree. If a and b are not ordered (ie not comparable), it is an
>error to try to compare them. Hence a < b (or any of the other 5 operators)
>are free to do whatever they like - throw an exception, return a random
>value or start up a game of tetris.

Tell that to the  committee that developed the IEEE floating point standard.  It
is NOT considered an error to compare a NaN and, say, 1.0 -- the result is
neither <, = nor >.  It is unordered.  If I have four possiblities for an ordering
relation (as I do for a partial order), then I have four relations defined.  Exactly
one of those is true for any two objects and the other three are false.  C++ does
not define a native "unordered" operator (but it should, for IEEE floating
point, if nothing else).  So if I ask (a < b) and they are unordered then the
result is false.  If a is equal to b then the  result is false.  No difference (logically).

It is only an error to compare to objects if they intrinsically cannot be compared.
But if they are merely unordered it is not an error.

Michael Lee Finney
Technical Details
Message-ID: <409cbi$59c@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> <3vutg6$713@mujibur.inmind.com> <408o8u$c0p@hermes.synopsys.com>

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: 9 Aug 1995 04:08:18 GMT
Organization: In Mind, Inc.
Message-ID: <409cbi$59c@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> <3vutg6$713@mujibur.inmind.com> <408o8u$c0p@hermes.synopsys.com>
Reply-To: mfinney@inmind.com
NNTP-Posting-Host: finneyman.inmind.com
X-Newsreader: IBM NewsReader/2 v1.2