WAT: opCmp and opEquals woes
Fool via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jul 27 11:00:27 PDT 2014
On Sunday, 27 July 2014 at 16:39:01 UTC, Ola Fosheim Grøstad
wrote:
> On Saturday, 26 July 2014 at 16:43:06 UTC, Fool wrote:
>>> NaN < x is false
>>> NaN > x is false
>>
>> ...which means that < as it is usually defined on floating
>> point numbers does not define a strict weak ordering.
>
> Are you sure?
One can define a strict weak ordering using different (but
equivalent) sets of axioms.
We have
NOT (0.0 < NaN) AND NOT (NaN < 0.0) [0.0 and NaN are
incomparable]
AND
NOT (NaN < 1.0) AND NOT (1.0 < NaN) [NaN and 1.0 are
incomparable]
However, it does NOT hold
NOT (0.0 < 1.0) AND NOT (1.0 < 0.0) [0.0 and 1.0 are
incomparable]
Thus we do not have transitivity of incomparability:
"For all x, y, and z, if x is incomparable with y, and y is
incomparable with z, then x is incomparable with z." [1]
[1]
https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings
More information about the Digitalmars-d
mailing list