X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=library%2Fstd%2Fsrc%2Fprimitive_docs.rs;h=64b22b64f4bf12cc840705a32200735d665df35a;hb=ad2a80e412768fd2c9a162a3b68e1489af446f2f;hp=d4bb2083d00d84216b3e3e8fac3053a904c6c543;hpb=f3218dfa57105c66fd964c6df3942c36e475b39c;p=rust.git diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs index d4bb2083d00..64b22b64f4b 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.0: IEEE 754 floating point numbers have a bit that indicates their sign, so -0.0 is a +/// possible value. For comparison `-0.0 == +0.0` is true but floating point operations can +/// carry the sign bit through arithmetic operations. This means `-1.0 * 0.0` produces -0.0 and +/// a negative number rounded to a value smaller than a float can represent also produces -0.0. /// - [∞](#associatedconstant.INFINITY) and /// [−∞](#associatedconstant.NEG_INFINITY): these result from calculations /// like `1.0 / 0.0`.