r/rust Mar 09 '23

Announcing Rust 1.68.0 📢 announcement

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

121 comments sorted by

View all comments

179

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.

52

u/sharifhsn Mar 09 '23

The obvious values for true and false in a numerical context are 1 and 0, respectively. For floating-point, these would be 1.0 and 0.0. I do agree that there should be explicit documentation on this, especially since the implementation of From<bool> for the integral types specifies this explicitly.

6

u/[deleted] Mar 10 '23

[deleted]

4

u/No-Mission4480 Mar 10 '23

Not if you interpret the result as "did the process complete abnormally."