I see that we are comparing bits for this. I want to understand when this would be a wise thing to do and when the potential pitfalls of floating-point comparisons have to kept in mind. This is partially breaking my brain a bit. Any help would be appreciated!
The code in playground was always "valid", in that it always could be compiled, even in Rust 1.0; and it is still "incorrect", in that you usually can't get any useful information from comparing floating point values for equality (the only exception is when you check if they are literally a copy of each other).
The method you're referring to isn't connected in any way to the == operator; it is to be called explicitly, wherever we need to have an ordering (not an equality) which handles NaNs gracefully.
The trait that implements == is PartialEq, not Eq.
Partial equality means that you are allowed to compare two values of the type, but a value may not always be equal to itself. It doesn't mean that equality comparison can't be defined.
While I have your attention, can you kindly help with the reason why PartialEq is being implemented for floats but Eq is not being implemented (if we are just comparing bit pattern)?