Article View: comp.std.c++
Article #1669Re: STL operators != > <= >=
From: Mike Chapman
Date: Tue, 08 Aug 1995 22:25
Date: Tue, 08 Aug 1995 22:25
34 lines
2321 bytes
2321 bytes
mfinney@inmind.com wrote:
[ snip snip ]
>
>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.
>
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.
--
Mike Chapman, Munich
Some programming languages manage to absorb change,
but withstand progress.
-- Epigrams in Programming, ACM SIGPLAN Sept. 1982
.................................................................
.................................................................
.................................................................
.................................................................
(For the benefit of my brain dead news host.)
Technical Details
Message-ID:
<408o8u$c0p@hermes.synopsys.com>Path:
arc1-ca.pugleaf.net!news.synopsys.com!usenetReferences:
<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>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.synopsys.com!usenet From: Mike Chapman <mchapman@synopsys.com> Newsgroups: comp.std.c++ Subject: Re: STL operators != > <= >= Date: 8 Aug 1995 22:25:34 GMT Organization: Synopsys CD group, Munich, Germany Message-ID: <408o8u$c0p@hermes.synopsys.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> NNTP-Posting-Host: 146.225.208.233 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.1N (X11; I; Linux 1.2.11 i486) X-URL: news:3vutg6$713@mujibur.inmind.com