Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions library/core/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2949,8 +2949,7 @@ pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize);

/// Returns the minimum of two `f16` values, ignoring NaN.
///
/// This behaves like IEEE 754-2008 minNum. In particular:
/// If one of the arguments is NaN, then the other argument is returned. If the inputs compare equal
/// If one of the arguments is NaN (quiet or signaling), then the other argument is returned. If the inputs compare equal
/// (such as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
Comment on lines 2950 to 2953
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth also mentioning the (NaN,NaN) case? Similar to #149477

///
/// Note that, unlike most intrinsics, this is safe to call;
Expand All @@ -2965,8 +2964,7 @@ pub const fn minnumf16(x: f16, y: f16) -> f16;

/// Returns the minimum of two `f32` values, ignoring NaN.
///
/// This behaves like IEEE 754-2008 minNum. In particular:
/// If one of the arguments is NaN, then the other argument is returned. If the inputs compare equal
/// If one of the arguments is NaN (quiet or signaling), then the other argument is returned. If the inputs compare equal
/// (such as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
///
/// Note that, unlike most intrinsics, this is safe to call;
Expand All @@ -2982,8 +2980,7 @@ pub const fn minnumf32(x: f32, y: f32) -> f32;

/// Returns the minimum of two `f64` values, ignoring NaN.
///
/// This behaves like IEEE 754-2008 minNum. In particular:
/// If one of the arguments is NaN, then the other argument is returned. If the inputs compare equal
/// If one of the arguments is NaN (quiet or signaling), then the other argument is returned. If the inputs compare equal
/// (such as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
///
/// Note that, unlike most intrinsics, this is safe to call;
Expand All @@ -2999,8 +2996,7 @@ pub const fn minnumf64(x: f64, y: f64) -> f64;

/// Returns the minimum of two `f128` values, ignoring NaN.
///
/// This behaves like IEEE 754-2008 minNum. In particular:
/// If one of the arguments is NaN, then the other argument is returned. If the inputs compare equal
/// If one of the arguments is NaN (quiet or signaling), then the other argument is returned. If the inputs compare equal
/// (such as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
///
/// Note that, unlike most intrinsics, this is safe to call;
Expand Down Expand Up @@ -3115,8 +3111,7 @@ pub const fn minimumf128(x: f128, y: f128) -> f128 {

/// Returns the maximum of two `f16` values, ignoring NaN.
///
/// This behaves like IEEE 754-2008 maxNum. In particular:
/// If one of the arguments is NaN, then the other argument is returned. If the inputs compare equal
/// If one of the arguments is NaN (quiet or signaling), then the other argument is returned. If the inputs compare equal
/// (such as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
///
/// Note that, unlike most intrinsics, this is safe to call;
Expand All @@ -3131,8 +3126,7 @@ pub const fn maxnumf16(x: f16, y: f16) -> f16;

/// Returns the maximum of two `f32` values, ignoring NaN.
///
/// This behaves like IEEE 754-2008 maxNum. In particular:
/// If one of the arguments is NaN, then the other argument is returned. If the inputs compare equal
/// If one of the arguments is NaN (quiet or signaling), then the other argument is returned. If the inputs compare equal
/// (such as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
///
/// Note that, unlike most intrinsics, this is safe to call;
Expand All @@ -3148,8 +3142,7 @@ pub const fn maxnumf32(x: f32, y: f32) -> f32;

/// Returns the maximum of two `f64` values, ignoring NaN.
///
/// This behaves like IEEE 754-2008 maxNum. In particular:
/// If one of the arguments is NaN, then the other argument is returned. If the inputs compare equal
/// If one of the arguments is NaN (quiet or signaling), then the other argument is returned. If the inputs compare equal
/// (such as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
///
/// Note that, unlike most intrinsics, this is safe to call;
Expand All @@ -3165,8 +3158,7 @@ pub const fn maxnumf64(x: f64, y: f64) -> f64;

/// Returns the maximum of two `f128` values, ignoring NaN.
///
/// This behaves like IEEE 754-2008 maxNum. In particular:
/// If one of the arguments is NaN, then the other argument is returned. If the inputs compare equal
/// If one of the arguments is NaN (quiet or signaling), then the other argument is returned. If the inputs compare equal
/// (such as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
///
/// Note that, unlike most intrinsics, this is safe to call;
Expand Down
30 changes: 16 additions & 14 deletions library/core/src/num/f128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,14 +694,15 @@ impl f128 {

/// Returns the maximum of the two numbers, ignoring NaN.
///
/// If exactly one of the arguments is NaN, then the other argument is returned. If both
/// arguments are NaN, the return value is NaN, with the bit pattern picked using the usual
/// [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs compare equal (such
/// as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
/// If exactly one of the arguments is NaN (quiet or signaling), then the other argument is
/// returned. If both arguments are NaN, the return value is NaN, with the bit pattern picked
/// using the usual [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs
/// compare equal (such as for the case of `+0.0` and `-0.0`), either input may be returned
/// non-deterministically.
///
/// This follows the IEEE 754-2008 semantics for `maxNum`, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids `maxNum`'s problems with associativity.
/// This also matches the behavior of libm’s `fmax`.
/// The handling of NaNs follows the IEEE 754-2019 semantics for `maximumNumber`, treating all
/// NaNs the same way to ensure the operation is associative. The handling of signed zeros
/// follows the IEEE 754-2008 semantics for `maxNum`.
///
/// ```
/// #![feature(f128)]
Expand All @@ -725,14 +726,15 @@ impl f128 {

/// Returns the minimum of the two numbers, ignoring NaN.
///
/// If exactly one of the arguments is NaN, then the other argument is returned. If both
/// arguments are NaN, the return value is NaN, with the bit pattern picked using the usual
/// [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs compare equal (such
/// as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
/// If exactly one of the arguments is NaN (quiet or signaling), then the other argument is
/// returned. If both arguments are NaN, the return value is NaN, with the bit pattern picked
/// using the usual [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs
/// compare equal (such as for the case of `+0.0` and `-0.0`), either input may be returned
/// non-deterministically.
///
/// This follows the IEEE 754-2008 semantics for `minNum`, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids `minNum`'s problems with associativity.
/// This also matches the behavior of libm’s `fmin`.
/// The handling of NaNs follows the IEEE 754-2019 semantics for `minimumNumber`, treating all
/// NaNs the same way to ensure the operation is associative. The handling of signed zeros
/// follows the IEEE 754-2008 semantics for `minNum`.
///
/// ```
/// #![feature(f128)]
Expand Down
30 changes: 16 additions & 14 deletions library/core/src/num/f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,14 +687,15 @@ impl f16 {

/// Returns the maximum of the two numbers, ignoring NaN.
///
/// If exactly one of the arguments is NaN, then the other argument is returned. If both
/// arguments are NaN, the return value is NaN, with the bit pattern picked using the usual
/// [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs compare equal (such
/// as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
/// If exactly one of the arguments is NaN (quiet or signaling), then the other argument is
/// returned. If both arguments are NaN, the return value is NaN, with the bit pattern picked
/// using the usual [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs
/// compare equal (such as for the case of `+0.0` and `-0.0`), either input may be returned
/// non-deterministically.
///
/// This follows the IEEE 754-2008 semantics for `maxNum`, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids `maxNum`'s problems with associativity.
/// This also matches the behavior of libm’s `fmax`.
/// The handling of NaNs follows the IEEE 754-2019 semantics for `maximumNumber`, treating all
/// NaNs the same way to ensure the operation is associative. The handling of signed zeros
/// follows the IEEE 754-2008 semantics for `maxNum`.
///
/// ```
/// #![feature(f16)]
Expand All @@ -717,14 +718,15 @@ impl f16 {

/// Returns the minimum of the two numbers, ignoring NaN.
///
/// If exactly one of the arguments is NaN, then the other argument is returned. If both
/// arguments are NaN, the return value is NaN, with the bit pattern picked using the usual
/// [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs compare equal (such
/// as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
/// If exactly one of the arguments is NaN (quiet or signaling), then the other argument is
/// returned. If both arguments are NaN, the return value is NaN, with the bit pattern picked
/// using the usual [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs
/// compare equal (such as for the case of `+0.0` and `-0.0`), either input may be returned
/// non-deterministically.
///
/// This follows the IEEE 754-2008 semantics for `minNum`, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids `minNum`'s problems with associativity.
/// This also matches the behavior of libm’s `fmin`.
/// The handling of NaNs follows the IEEE 754-2019 semantics for `minimumNumber`, treating all
/// NaNs the same way to ensure the operation is associative. The handling of signed zeros
/// follows the IEEE 754-2008 semantics for `minNum`.
///
/// ```
/// #![feature(f16)]
Expand Down
30 changes: 16 additions & 14 deletions library/core/src/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -897,14 +897,15 @@ impl f32 {

/// Returns the maximum of the two numbers, ignoring NaN.
///
/// If exactly one of the arguments is NaN, then the other argument is returned. If both
/// arguments are NaN, the return value is NaN, with the bit pattern picked using the usual
/// [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs compare equal (such
/// as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
/// If exactly one of the arguments is NaN (quiet or signaling), then the other argument is
/// returned. If both arguments are NaN, the return value is NaN, with the bit pattern picked
/// using the usual [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs
/// compare equal (such as for the case of `+0.0` and `-0.0`), either input may be returned
/// non-deterministically.
///
/// This follows the IEEE 754-2008 semantics for `maxNum`, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids `maxNum`'s problems with associativity.
/// This also matches the behavior of libm’s `fmax`.
/// The handling of NaNs follows the IEEE 754-2019 semantics for `maximumNumber`, treating all
/// NaNs the same way to ensure the operation is associative. The handling of signed zeros
/// follows the IEEE 754-2008 semantics for `maxNum`.
///
/// ```
/// let x = 1.0f32;
Expand All @@ -923,14 +924,15 @@ impl f32 {

/// Returns the minimum of the two numbers, ignoring NaN.
///
/// If exactly one of the arguments is NaN, then the other argument is returned. If both
/// arguments are NaN, the return value is NaN, with the bit pattern picked using the usual
/// [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs compare equal (such
/// as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
/// If exactly one of the arguments is NaN (quiet or signaling), then the other argument is
/// returned. If both arguments are NaN, the return value is NaN, with the bit pattern picked
/// using the usual [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs
/// compare equal (such as for the case of `+0.0` and `-0.0`), either input may be returned
/// non-deterministically.
///
/// This follows the IEEE 754-2008 semantics for `minNum`, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids `minNum`'s problems with associativity.
/// This also matches the behavior of libm’s `fmin`.
/// The handling of NaNs follows the IEEE 754-2019 semantics for `minimumNumber`, treating all
/// NaNs the same way to ensure the operation is associative. The handling of signed zeros
/// follows the IEEE 754-2008 semantics for `minNum`.
///
/// ```
/// let x = 1.0f32;
Expand Down
30 changes: 16 additions & 14 deletions library/core/src/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,14 +915,15 @@ impl f64 {

/// Returns the maximum of the two numbers, ignoring NaN.
///
/// If exactly one of the arguments is NaN, then the other argument is returned. If both
/// arguments are NaN, the return value is NaN, with the bit pattern picked using the usual
/// [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs compare equal (such
/// as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
/// If exactly one of the arguments is NaN (quiet or signaling), then the other argument is
/// returned. If both arguments are NaN, the return value is NaN, with the bit pattern picked
/// using the usual [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs
/// compare equal (such as for the case of `+0.0` and `-0.0`), either input may be returned
/// non-deterministically.
///
/// This follows the IEEE 754-2008 semantics for `maxNum`, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids `maxNum`'s problems with associativity.
/// This also matches the behavior of libm’s `fmax`.
/// The handling of NaNs follows the IEEE 754-2019 semantics for `maximumNumber`, treating all
/// NaNs the same way to ensure the operation is associative. The handling of signed zeros
/// follows the IEEE 754-2008 semantics for `maxNum`.
///
/// ```
/// let x = 1.0_f64;
Expand All @@ -941,14 +942,15 @@ impl f64 {

/// Returns the minimum of the two numbers, ignoring NaN.
///
/// If exactly one of the arguments is NaN, then the other argument is returned. If both
/// arguments are NaN, the return value is NaN, with the bit pattern picked using the usual
/// [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs compare equal (such
/// as for the case of `+0.0` and `-0.0`), either input may be returned non-deterministically.
/// If exactly one of the arguments is NaN (quiet or signaling), then the other argument is
/// returned. If both arguments are NaN, the return value is NaN, with the bit pattern picked
/// using the usual [rules for arithmetic operations](f32#nan-bit-patterns). If the inputs
/// compare equal (such as for the case of `+0.0` and `-0.0`), either input may be returned
/// non-deterministically.
///
/// This follows the IEEE 754-2008 semantics for `minNum`, except for handling of signaling NaNs;
/// this function handles all NaNs the same way and avoids `minNum`'s problems with associativity.
/// This also matches the behavior of libm’s `fmin`.
/// The handling of NaNs follows the IEEE 754-2019 semantics for `minimumNumber`, treating all
/// NaNs the same way to ensure the operation is associative. The handling of signed zeros
/// follows the IEEE 754-2008 semantics for `minNum`.
///
/// ```
/// let x = 1.0_f64;
Expand Down
Loading