]> git.lizzy.rs Git - rust.git/commitdiff
Improve wording of "NaN as a special value" top level explanation
authorPyry Kontio <pyry.kontio@drasa.eu>
Thu, 31 Mar 2022 02:27:23 +0000 (11:27 +0900)
committerPyry Kontio <pyry.kontio@drasa.eu>
Thu, 31 Mar 2022 02:27:23 +0000 (11:27 +0900)
library/core/src/primitive_docs.rs
library/std/src/primitive_docs.rs

index 188cb8f983bc197a68cbc64c0b73121d0bcc21fc..ab4bb0f26696b2c1dd841027213ebe8a31b8c474 100644 (file)
@@ -978,14 +978,15 @@ mod prim_tuple {}
 /// - [NaN (not a number)](#associatedconstant.NAN): this value results from
 ///   calculations like `(-1.0).sqrt()`. NaN has some potentially unexpected
 ///   behavior:
-///   - It is unequal to any float, including itself!
+///   - It is unequal to any float, including itself! This is the reason `f32`
+///     doesn't implement the `Eq` trait.
 ///   - It is also neither smaller nor greater than any float, making it
-///     impossible to sort by the default comparison operation. This is the
-///     reason `f32` doesn't implement the `Ord` and `Eq` traits.
+///     impossible to sort by the default comparison operation, which is the
+///     reason `f32` doesn't implement the `Ord` trait.
 ///   - It is also considered *infectious* as almost all calculations where one
 ///     of the operands is NaN will also result in NaN. The explanations on this
 ///     page only explicitly document behavior on NaN operands if this default
-///     is *not* observed by the operation.
+///     is deviated from.
 ///   - Lastly, there are multiple bit patterns that are considered NaN.
 ///     Rust does not currently guarantee that the bit patterns of NaN are
 ///     preserved over arithmetic operations,
index 188cb8f983bc197a68cbc64c0b73121d0bcc21fc..ab4bb0f26696b2c1dd841027213ebe8a31b8c474 100644 (file)
@@ -978,14 +978,15 @@ mod prim_tuple {}
 /// - [NaN (not a number)](#associatedconstant.NAN): this value results from
 ///   calculations like `(-1.0).sqrt()`. NaN has some potentially unexpected
 ///   behavior:
-///   - It is unequal to any float, including itself!
+///   - It is unequal to any float, including itself! This is the reason `f32`
+///     doesn't implement the `Eq` trait.
 ///   - It is also neither smaller nor greater than any float, making it
-///     impossible to sort by the default comparison operation. This is the
-///     reason `f32` doesn't implement the `Ord` and `Eq` traits.
+///     impossible to sort by the default comparison operation, which is the
+///     reason `f32` doesn't implement the `Ord` trait.
 ///   - It is also considered *infectious* as almost all calculations where one
 ///     of the operands is NaN will also result in NaN. The explanations on this
 ///     page only explicitly document behavior on NaN operands if this default
-///     is *not* observed by the operation.
+///     is deviated from.
 ///   - Lastly, there are multiple bit patterns that are considered NaN.
 ///     Rust does not currently guarantee that the bit patterns of NaN are
 ///     preserved over arithmetic operations,