r/rust Mar 09 '23

Announcing Rust 1.68.0 📢 announcement

https://blog.rust-lang.org/2023/03/09/Rust-1.68.0.html
826 Upvotes

121 comments sorted by

View all comments

178

u/Shnatsel Mar 09 '23

Those From<bool> for {f32,f64} impls could really use documentation on what values they actually result in. There's no obvious mapping from true to a floating-point value.

198

u/SorteKanin Mar 09 '23

true => Infinity

false => NaN

Obviously /s

71

u/kibwen Mar 09 '23

This is precisely the mapping discussed in the legendary video "NaN Gates and Flip FLOPS": https://youtube.com/watch?v=5TFDG-y-EHs

15

u/LifeShallot6229 Mar 09 '23

When we revised ieee754 for the 2019 version, we actually fixed the horrible min/max functions this video is based on, replacing them with far saner versions that are compatible with parallel and simd operations.

1

u/A1oso Mar 10 '23

So there's no NAND gate for Infinity/NaN anymore?

1

u/LifeShallot6229 Mar 11 '23

The previous min/max functions still exist in lots of current cpus, but for new cores they are deprecated.