diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2020-10-31 17:21:23 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2021-03-22 17:02:09 -0700 |
| commit | 6fdb8d8b360b91a10045fe74467b98d218b7ffe9 (patch) | |
| tree | 45126060ea5e671e3b79430313bf722e4686f975 /library/std/src | |
| parent | 74db93ed2d0677bbca8ba85617f05eae745363d8 (diff) | |
| download | rust-6fdb8d8b360b91a10045fe74467b98d218b7ffe9.tar.gz rust-6fdb8d8b360b91a10045fe74467b98d218b7ffe9.zip | |
Update signed fmt/-0f32 docs
"semantic equivalence" is too strong a phrasing here, which is why actually explaining what kind of circumstances might produce a -0 was chosen instead.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/primitive_docs.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs index d4bb2083d00..b48718df31c 100644 --- a/library/std/src/primitive_docs.rs +++ b/library/std/src/primitive_docs.rs @@ -805,10 +805,12 @@ mod prim_tuple {} /// often discard insignificant digits: `println!("{}", 1.0f32 / 5.0f32)` will /// print `0.2`. /// -/// Additionally, `f32` can represent a couple of special values: +/// Additionally, `f32` can represent some special values: /// -/// - `-0`: this is just due to how floats are encoded. It is semantically -/// equivalent to `0` and `-0.0 == 0.0` results in `true`. +/// - `-0`: this value exists due to how floats are encoded. -0 == 0 is true, but for other +/// operations they are not equal and the difference can be useful to certain algorithms. +/// For example, operations on negative numbers that underflow to 0 will usually generate -0 +/// instead of +0. /// - [∞](#associatedconstant.INFINITY) and /// [−∞](#associatedconstant.NEG_INFINITY): these result from calculations /// like `1.0 / 0.0`. |
