WAT: opCmp and opEquals woes

via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 27 09:39:00 PDT 2014


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?

Properties of a Strict Weak Ordering:

#1 not(a < a)
#2 not(a < b and b < c) or a < c
#3 not(a < b) or (not b < a)
#4 not(a < b) or (a < c or c < b or ( a < c and c < b))

#1 is always true
#2 is always true if any of a,b,c are NaN
#3 and #4 are always true if any of a,b are NaN by "not(a<b)"

>> if you try to derive equality from that you would get:
>>
>> NaN == x is true
>
> This is not a contradiction to what I wrote.

Maybe you are right, but it does not match up to what I arrived 
at based on the properties for Strict Weak Ordering listed in 
Wikipedia.


More information about the Digitalmars-d mailing list