Skip to content

Commit d5bb605

Browse files
committed
Document the resulting values produced when using From<bool> on floats
1 parent 39f2657 commit d5bb605

File tree

1 file changed

+2
-1
lines changed
  • library/core/src/convert

1 file changed

+2
-1
lines changed

library/core/src/convert/num.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ impl_from! { f32, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0"
172172
#[stable(feature = "float_from_bool", since = "1.68.0")]
173173
#[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
174174
impl const From<bool> for f32 {
175-
/// Converts `bool` to `f32` losslessly.
175+
/// Converts `bool` to `f32` losslessly. The resulting value is `0.0` for
176+
/// `false` and `1.0` for `true` values.
176177
#[inline]
177178
fn from(small: bool) -> Self {
178179
small as u8 as Self

0 commit comments

Comments
 (0)