Skip to content

Commit f6b7727

Browse files
committed
enumerate the two parts of the NaN rules
1 parent 08fadfd commit f6b7727

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

Diff for: library/core/src/primitive_docs.rs

+21-20
Original file line numberDiff line numberDiff line change
@@ -1235,26 +1235,27 @@ mod prim_f16 {}
12351235
/// operations are guaranteed to exactly preserve the bit pattern of their input except for possibly
12361236
/// changing the sign bit.
12371237
///
1238-
/// The following rules apply when a NaN value is returned from an arithmetic operation: the result
1239-
/// has a non-deterministic sign. The quiet bit and payload are non-deterministically chosen from
1240-
/// the following set of options:
1241-
///
1242-
/// - **Preferred NaN**: The quiet bit is set and the payload is all-zero.
1243-
/// - **Quieting NaN propagation**: The quiet bit is set and the payload is copied from any input
1244-
/// operand that is a NaN. If the inputs and outputs do not have the same payload size (i.e., for
1245-
/// `as` casts), then
1246-
/// - If the output is smaller than the input, low-order bits of the payload get dropped.
1247-
/// - If the output is larger than the input, the payload gets filled up with 0s in the low-order
1248-
/// bits.
1249-
/// - **Unchanged NaN propagation**: The quiet bit and payload are copied from any input operand
1250-
/// that is a NaN. If the inputs and outputs do not have the same size (i.e., for `as` casts), the
1251-
/// same rules as for "quieting NaN propagation" apply, with one caveat: if the output is smaller
1252-
/// than the input, droppig the low-order bits may result in a payload of 0; a payload of 0 is not
1253-
/// possible with a signaling NaN (the all-0 significand encodes an infinity) so unchanged NaN
1254-
/// propagation cannot occur with some inputs.
1255-
/// - **Target-specific NaN**: The quiet bit is set and the payload is picked from a target-specific
1256-
/// set of "extra" possible NaN payloads. The set can depend on the input operand values.
1257-
/// See the table below for the concrete NaNs this set contains on various targets.
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.
12581259
///
12591260
/// In particular, if all input NaNs are quiet (or if there are no input NaNs), then the output NaN
12601261
/// is definitely quiet. Signaling NaN outputs can only occur if they are provided as an input

0 commit comments

Comments
 (0)