diff options
| author | bmoxb <maxoblack@yahoo.com> | 2023-03-09 18:55:28 +0000 |
|---|---|---|
| committer | bmoxb <maxoblack@yahoo.com> | 2023-03-09 18:55:33 +0000 |
| commit | d5bb6056f16bae301b498bd44ad286685bb5e618 (patch) | |
| tree | 08250d7bf96601dc98461757d939a9dc59d98891 | |
| parent | 39f2657d1101b50f9b71ae460b762d330cc8426b (diff) | |
| download | rust-d5bb6056f16bae301b498bd44ad286685bb5e618.tar.gz rust-d5bb6056f16bae301b498bd44ad286685bb5e618.zip | |
Document the resulting values produced when using `From<bool>` on floats
| -rw-r--r-- | library/core/src/convert/num.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/convert/num.rs b/library/core/src/convert/num.rs index 4da7c323492..8c407d07c51 100644 --- a/library/core/src/convert/num.rs +++ b/library/core/src/convert/num.rs @@ -172,7 +172,8 @@ impl_from! { f32, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0" #[stable(feature = "float_from_bool", since = "1.68.0")] #[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")] impl const From<bool> for f32 { - /// Converts `bool` to `f32` losslessly. + /// Converts `bool` to `f32` losslessly. The resulting value is `0.0` for + /// `false` and `1.0` for `true` values. #[inline] fn from(small: bool) -> Self { small as u8 as Self |
