1. 23
  1. 6

    Fascinating story! This is exactly the problem that Rust’s strictness around comparing floating point numbers is designed to mitigate. Of course Rust doesn’t eliminate the danger of code like this entirely, because it’s still possible to roll your own min and max logic using < and >, but it does forbid you from naively calling min or max on floats, because floats only implement the PartialOrd trait, not Ord. Rust is the only language I know of that puts even so much as a warning label on floating point comparison.

    Stories with similar links:

    1. Babbage was a true genius via friendlysock 1 year ago | 38 points | 13 comments
    2. Why didn't Larrabee fail? via chadski 5 years ago | 13 points | no comments