News for hackers. Stuff that matters.
Re:JavaScript: The Curious Case of null >= 0 by matthewaveryusa on Saturday September 09, 2017 @10:36AM (#15207255)
Yes. For X and Y being of the same type, defining the < operator should be enough to derive all other operators:

Define X < Y, and then derive the rest:

X > Y : X < Y

X == Y: !(X < Y) && !(Y > X)

X != Y: !(X == Y)

X >= Y: !(X < Y)

X <= Y: !(Y < X)

That's why it's the only operator that needs to be defined for std::map/set (which are rb-trees) in C++

Now, if X and Y aren't the same type, the only thing you can expect to get out of the system is a cronenberg.

Re:JavaScript: The Curious Case of null &gt;= 0 by adwn on Saturday September 09, 2017 @11:13AM (#15207451)
> X == Y: !(X < Y) && !(Y > X)

Only for totally ordered sets [1]. Floating-point numbers, for example, are not totally ordered, because !(NaN == NaN).

[1] https://en.wikipedia.org/wiki/Total_order