@@ -1127,7 +1127,7 @@ impl<T> (T,) {}
1127
1127
1128
1128
#[ rustc_doc_primitive = "f16" ]
1129
1129
#[ 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).
1131
1131
///
1132
1132
/// This type is very similar to [`prim@f32`] but has decreased precision because it uses half as many
1133
1133
/// bits. Please see [the documentation for `f32`](prim@f32) or [Wikipedia on half-precision
@@ -1147,11 +1147,11 @@ mod prim_f16 {}
1147
1147
1148
1148
#[ rustc_doc_primitive = "f32" ]
1149
1149
#[ 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).
1151
1151
///
1152
1152
/// This type can represent a wide range of decimal numbers, like `3.5`, `27`,
1153
1153
/// `-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,
1155
1155
/// too.
1156
1156
///
1157
1157
/// However, being able to represent this wide range of numbers comes at the
@@ -1165,8 +1165,8 @@ mod prim_f16 {}
1165
1165
///
1166
1166
/// Additionally, `f32` can represent some special values:
1167
1167
///
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
1170
1170
/// the sign bit through arithmetic operations. This means −0.0 × +0.0 produces −0.0 and
1171
1171
/// a negative number rounded to a value smaller than a float can represent also produces −0.0.
1172
1172
/// - [∞](#associatedconstant.INFINITY) and
@@ -1211,55 +1211,59 @@ mod prim_f16 {}
1211
1211
/// both arguments were negative, then it is -0.0. Subtraction `a - b` is
1212
1212
/// regarded as a sum `a + (-b)`.
1213
1213
///
1214
- /// For more information on floating point numbers, see [Wikipedia][wikipedia].
1214
+ /// For more information on floating- point numbers, see [Wikipedia][wikipedia].
1215
1215
///
1216
1216
/// *[See also the `std::f32::consts` module](crate::f32::consts).*
1217
1217
///
1218
1218
/// [wikipedia]: https://en.wikipedia.org/wiki/Single-precision_floating-point_format
1219
1219
///
1220
1220
/// # NaN bit patterns
1221
1221
///
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.
1225
1223
///
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".
1229
1229
/// - 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.
1255
1259
///
1256
1260
/// In particular, if all input NaNs are quiet (or if there are no input NaNs), then the output NaN
1257
1261
/// is definitely quiet. Signaling NaN outputs can only occur if they are provided as an input
1258
1262
/// value. Similarly, if all input NaNs are preferred (or if there are no input NaNs) and the target
1259
1263
/// does not have any "extra" NaN payloads, then the output NaN is guaranteed to be preferred.
1260
1264
///
1261
1265
/// 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
1263
1267
/// times will yield consistent results), but running the same operation twice with the same inputs
1264
1268
/// can produce different results.
1265
1269
///
@@ -1273,10 +1277,10 @@ mod prim_f16 {}
1273
1277
/// (e.g. `min`, `minimum`, `max`, `maximum`); other aspects of their semantics and which IEEE 754
1274
1278
/// operation they correspond to are documented with the respective functions.
1275
1279
///
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.
1280
1284
///
1281
1285
/// ### Target-specific "extra" NaN values
1282
1286
// FIXME: Is there a better place to put this?
@@ -1294,7 +1298,7 @@ mod prim_f32 {}
1294
1298
1295
1299
#[ rustc_doc_primitive = "f64" ]
1296
1300
#[ 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).
1298
1302
///
1299
1303
/// This type is very similar to [`prim@f32`], but has increased precision by using twice as many
1300
1304
/// bits. Please see [the documentation for `f32`](prim@f32) or [Wikipedia on double-precision
@@ -1308,7 +1312,7 @@ mod prim_f64 {}
1308
1312
1309
1313
#[ rustc_doc_primitive = "f128" ]
1310
1314
#[ 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).
1312
1316
///
1313
1317
/// This type is very similar to [`prim@f32`] and [`prim@f64`], but has increased precision by using twice
1314
1318
/// as many bits as `f64`. Please see [the documentation for `f32`](prim@f32) or [Wikipedia on
0 commit comments