@@ -1127,7 +1127,7 @@ impl<T> (T,) {}
11271127
11281128#[ rustc_doc_primitive = "f16" ]
11291129#[ doc( alias = "half" ) ]
1130- /// A 16-bit floating point type (specifically, the "binary16" type defined in IEEE 754-2008).
1130+ /// A 16-bit floating- point type (specifically, the "binary16" type defined in IEEE 754-2008).
11311131///
11321132/// This type is very similar to [`prim@f32`] but has decreased precision because it uses half as many
11331133/// bits. Please see [the documentation for `f32`](prim@f32) or [Wikipedia on half-precision
@@ -1147,11 +1147,11 @@ mod prim_f16 {}
11471147
11481148#[ rustc_doc_primitive = "f32" ]
11491149#[ doc( alias = "single" ) ]
1150- /// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
1150+ /// A 32-bit floating- point type (specifically, the "binary32" type defined in IEEE 754-2008).
11511151///
11521152/// This type can represent a wide range of decimal numbers, like `3.5`, `27`,
11531153/// `-113.75`, `0.0078125`, `34359738368`, `0`, `-1`. So unlike integer types
1154- /// (such as `i32`), floating point types can represent non-integer numbers,
1154+ /// (such as `i32`), floating- point types can represent non-integer numbers,
11551155/// too.
11561156///
11571157/// However, being able to represent this wide range of numbers comes at the
@@ -1165,8 +1165,8 @@ mod prim_f16 {}
11651165///
11661166/// Additionally, `f32` can represent some special values:
11671167///
1168- /// - −0.0: IEEE 754 floating point numbers have a bit that indicates their sign, so −0.0 is a
1169- /// possible value. For comparison −0.0 = +0.0, but floating point operations can carry
1168+ /// - −0.0: IEEE 754 floating- point numbers have a bit that indicates their sign, so −0.0 is a
1169+ /// possible value. For comparison −0.0 = +0.0, but floating- point operations can carry
11701170/// the sign bit through arithmetic operations. This means −0.0 × +0.0 produces −0.0 and
11711171/// a negative number rounded to a value smaller than a float can represent also produces −0.0.
11721172/// - [∞](#associatedconstant.INFINITY) and
@@ -1211,55 +1211,59 @@ mod prim_f16 {}
12111211/// both arguments were negative, then it is -0.0. Subtraction `a - b` is
12121212/// regarded as a sum `a + (-b)`.
12131213///
1214- /// For more information on floating point numbers, see [Wikipedia][wikipedia].
1214+ /// For more information on floating- point numbers, see [Wikipedia][wikipedia].
12151215///
12161216/// *[See also the `std::f32::consts` module](crate::f32::consts).*
12171217///
12181218/// [wikipedia]: https://en.wikipedia.org/wiki/Single-precision_floating-point_format
12191219///
12201220/// # NaN bit patterns
12211221///
1222- /// This section defines the possible NaN bit patterns returned by non-"bitwise" floating point
1223- /// operations. The bitwise operations are unary `-`, `abs`, `copysign`; those are guaranteed to
1224- /// exactly preserve the bit pattern of their input except for possibly changing the sign bit.
1222+ /// This section defines the possible NaN bit patterns returned by floating-point operations.
12251223///
1226- /// A floating-point NaN value consists of:
1227- /// - a sign bit
1228- /// - a quiet/signaling bit
1224+ /// The bit pattern of a floating-point NaN value is defined by:
1225+ /// - a sign bit.
1226+ /// - a quiet/signaling bit. Rust assumes that the quiet/signaling bit being set to `1` indicates a
1227+ /// quiet NaN (QNaN), and a value of `0` indicates a signaling NaN (SNaN). In the following we
1228+ /// will hence just call it the "quiet bit".
12291229/// - a payload, which makes up the rest of the significand (i.e., the mantissa) except for the
1230- /// quiet/signaling bit.
1231- ///
1232- /// Rust assumes that the quiet/signaling bit being set to `1` indicates a quiet NaN (QNaN), and a
1233- /// value of `0` indicates a signaling NaN (SNaN). In the following we will hence just call it the
1234- /// "quiet bit".
1235- ///
1236- /// The following rules apply when a NaN value is returned: the result has a non-deterministic sign.
1237- /// The quiet bit and payload are non-deterministically chosen from the following set of options:
1238- ///
1239- /// - **Preferred NaN**: The quiet bit is set and the payload is all-zero.
1240- /// - **Quieting NaN propagation**: The quiet bit is set and the payload is copied from any input
1241- /// operand that is a NaN. If the inputs and outputs do not have the same payload size (i.e., for
1242- /// `as` casts), then
1243- /// - If the output is smaller than the input, low-order bits of the payload get dropped.
1244- /// - If the output is larger than the input, the payload gets filled up with 0s in the low-order
1245- /// bits.
1246- /// - **Unchanged NaN propagation**: The quiet bit and payload are copied from any input operand
1247- /// that is a NaN. If the inputs and outputs do not have the same size (i.e., for `as` casts), the
1248- /// same rules as for "quieting NaN propagation" apply, with one caveat: if the output is smaller
1249- /// than the input, droppig the low-order bits may result in a payload of 0; a payload of 0 is not
1250- /// possible with a signaling NaN (the all-0 significand encodes an infinity) so unchanged NaN
1251- /// propagation cannot occur with some inputs.
1252- /// - **Target-specific NaN**: The quiet bit is set and the payload is picked from a target-specific
1253- /// set of "extra" possible NaN payloads. The set can depend on the input operand values.
1254- /// See the table below for the concrete NaNs this set contains on various targets.
1230+ /// quiet bit.
1231+ ///
1232+ /// The rules for NaN values differ between *arithmetic* and *non-arithmetic* (or "bitwise")
1233+ /// operations. The non-arithmetic operations are unary `-`, `abs`, `copysign`, `signum`,
1234+ /// `{to,from}_bits`, `{to,from}_{be,le,ne}_bytes` and `is_sign_{positive,negative}`. These
1235+ /// operations are guaranteed to exactly preserve the bit pattern of their input except for possibly
1236+ /// changing the sign bit.
1237+ ///
1238+ /// The following rules apply when a NaN value is returned from an arithmetic operation:
1239+ /// - The result has a non-deterministic sign.
1240+ /// - The quiet bit and payload are non-deterministically chosen from
1241+ /// the following set of options:
1242+ ///
1243+ /// - **Preferred NaN**: The quiet bit is set and the payload is all-zero.
1244+ /// - **Quieting NaN propagation**: The quiet bit is set and the payload is copied from any input
1245+ /// operand that is a NaN. If the inputs and outputs do not have the same payload size (i.e., for
1246+ /// `as` casts), then
1247+ /// - If the output is smaller than the input, low-order bits of the payload get dropped.
1248+ /// - If the output is larger than the input, the payload gets filled up with 0s in the low-order
1249+ /// bits.
1250+ /// - **Unchanged NaN propagation**: The quiet bit and payload are copied from any input operand
1251+ /// that is a NaN. If the inputs and outputs do not have the same size (i.e., for `as` casts), the
1252+ /// same rules as for "quieting NaN propagation" apply, with one caveat: if the output is smaller
1253+ /// than the input, droppig the low-order bits may result in a payload of 0; a payload of 0 is not
1254+ /// possible with a signaling NaN (the all-0 significand encodes an infinity) so unchanged NaN
1255+ /// propagation cannot occur with some inputs.
1256+ /// - **Target-specific NaN**: The quiet bit is set and the payload is picked from a target-specific
1257+ /// set of "extra" possible NaN payloads. The set can depend on the input operand values.
1258+ /// See the table below for the concrete NaNs this set contains on various targets.
12551259///
12561260/// In particular, if all input NaNs are quiet (or if there are no input NaNs), then the output NaN
12571261/// is definitely quiet. Signaling NaN outputs can only occur if they are provided as an input
12581262/// value. Similarly, if all input NaNs are preferred (or if there are no input NaNs) and the target
12591263/// does not have any "extra" NaN payloads, then the output NaN is guaranteed to be preferred.
12601264///
12611265/// The non-deterministic choice happens when the operation is executed; i.e., the result of a
1262- /// NaN-producing floating point operation is a stable bit pattern (looking at these bits multiple
1266+ /// NaN-producing floating- point operation is a stable bit pattern (looking at these bits multiple
12631267/// times will yield consistent results), but running the same operation twice with the same inputs
12641268/// can produce different results.
12651269///
@@ -1273,10 +1277,10 @@ mod prim_f16 {}
12731277/// (e.g. `min`, `minimum`, `max`, `maximum`); other aspects of their semantics and which IEEE 754
12741278/// operation they correspond to are documented with the respective functions.
12751279///
1276- /// When a floating-point operation is executed in `const` context, the same rules apply: no
1277- /// guarantee is made about which of the NaN bit patterns described above will be returned. The
1278- /// result does not have to match what happens when executing the same code at runtime, and the
1279- /// result can vary depending on factors such as compiler version and flags.
1280+ /// When an arithmetic floating-point operation is executed in `const` context, the same rules
1281+ /// apply: no guarantee is made about which of the NaN bit patterns described above will be
1282+ /// returned. The result does not have to match what happens when executing the same code at
1283+ /// runtime, and the result can vary depending on factors such as compiler version and flags.
12801284///
12811285/// ### Target-specific "extra" NaN values
12821286// FIXME: Is there a better place to put this?
@@ -1294,7 +1298,7 @@ mod prim_f32 {}
12941298
12951299#[ rustc_doc_primitive = "f64" ]
12961300#[ doc( alias = "double" ) ]
1297- /// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008).
1301+ /// A 64-bit floating- point type (specifically, the "binary64" type defined in IEEE 754-2008).
12981302///
12991303/// This type is very similar to [`prim@f32`], but has increased precision by using twice as many
13001304/// bits. Please see [the documentation for `f32`](prim@f32) or [Wikipedia on double-precision
@@ -1308,7 +1312,7 @@ mod prim_f64 {}
13081312
13091313#[ rustc_doc_primitive = "f128" ]
13101314#[ doc( alias = "quad" ) ]
1311- /// A 128-bit floating point type (specifically, the "binary128" type defined in IEEE 754-2008).
1315+ /// A 128-bit floating- point type (specifically, the "binary128" type defined in IEEE 754-2008).
13121316///
13131317/// This type is very similar to [`prim@f32`] and [`prim@f64`], but has increased precision by using twice
13141318/// as many bits as `f64`. Please see [the documentation for `f32`](prim@f32) or [Wikipedia on
0 commit comments