Today I learned some things that make me upset, in Rust:
* If you divide by zero with floats, they will return `inf` and not panic
* If you `as` cast an `inf` float to `i32`, it will return i32::MAX
Probably totally reasonable choices in isolation + practice, but WHEW was that fun to find.
* If you divide by zero with floats, they will return `inf` and not panic
* If you `as` cast an `inf` float to `i32`, it will return i32::MAX
Probably totally reasonable choices in isolation + practice, but WHEW was that fun to find.
Comments
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0267399969b01fc9e1aee9d78f9cbd54
https://doc.rust-lang.org/reference/expressions/operator-expr.html?highlight=satu#numeric-cast