Less-than-or-equals comparison operator. Falls back to (x < y) | (x == y).
In your case, x < y returns false as expected, but x == y also returns false because as the documentation says
Generic equality operator. Falls back to ===. Should be implemented for all types with a notion of equality, based on the abstract value that an instance represents.
[…]
New numeric types should implement this function for two arguments of the new type, and handle comparison to other types via promotion rules where possible.
So you need to implement ==, otherwise the default === is used which returns false in this case.
Thanks so much! This solves my problem, but I’d just like to note that the overall experience defining these operators is still quite confusing, esp. understanding which ones are required in order to get reasonable behavior.
In my case, I had tried defining isequal but not ==. I was (mistakenly) under the impression that these were equivalent.
You’re welcome! Each of these operators/functions has an “Implementation” section in the documentation that says what should be implemented in which case, but I agree it’s a bit confusing.