3 ms·
Rust handles this in a "correct", if annoying way: the stdlib sort requires its elements to have a "totally ordered" trait, and floating point doesn't have that
by dinosaurdynasty 4y ago
Rust handles this in a "correct", if annoying way: the stdlib sort requires its elements to have a "totally ordered" trait, and floating point doesn't have that trait. You have to either give a custom comparison function, or use a "non-NaN and totally orderable floating point" type some non-stdlib crates have.
- majewsky 4y agoThis perfectly illustrates the cultural difference between Rust and Go: Rust wants to be "correct", Go wants to be "good enough".