float::maximum/minimum: make docs more streamlined

This commit is contained in:
Ralf Jung 2025-11-30 11:59:43 +01:00
parent 91ab3083bb
commit e7734099d0
4 changed files with 72 additions and 72 deletions

View file

@ -750,8 +750,15 @@ impl f128 {
/// Returns the maximum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f128::max`] which only returns NaN when *both* arguments are NaN.
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
/// non-NaN inputs.
///
/// This is in contrast to [`f128::max`] which only returns NaN when *both* arguments are NaN,
/// and which does not reliably order `-0.0` and `+0.0`.
///
/// This follows the IEEE 754-2019 semantics for `maximum`.
///
/// ```
/// #![feature(f128)]
@ -766,13 +773,6 @@ impl f128 {
/// assert!(x.maximum(f128::NAN).is_nan());
/// # }
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the IEEE 754-2019 semantics for `maximum`.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
#[inline]
#[unstable(feature = "f128", issue = "116909")]
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]
@ -783,8 +783,15 @@ impl f128 {
/// Returns the minimum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f128::min`] which only returns NaN when *both* arguments are NaN.
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
/// non-NaN inputs.
///
/// This is in contrast to [`f128::min`] which only returns NaN when *both* arguments are NaN,
/// and which does not reliably order `-0.0` and `+0.0`.
///
/// This follows the IEEE 754-2019 semantics for `minimum`.
///
/// ```
/// #![feature(f128)]
@ -799,13 +806,6 @@ impl f128 {
/// assert!(x.minimum(f128::NAN).is_nan());
/// # }
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the IEEE 754-2019 semantics for `minimum`.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
#[inline]
#[unstable(feature = "f128", issue = "116909")]
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]

View file

@ -741,8 +741,15 @@ impl f16 {
/// Returns the maximum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f16::max`] which only returns NaN when *both* arguments are NaN.
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
/// non-NaN inputs.
///
/// This is in contrast to [`f16::max`] which only returns NaN when *both* arguments are NaN,
/// and which does not reliably order `-0.0` and `+0.0`.
///
/// This follows the IEEE 754-2019 semantics for `maximum`.
///
/// ```
/// #![feature(f16)]
@ -756,13 +763,6 @@ impl f16 {
/// assert!(x.maximum(f16::NAN).is_nan());
/// # }
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the IEEE 754-2019 semantics for `maximum`.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
#[inline]
#[unstable(feature = "f16", issue = "116909")]
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]
@ -773,8 +773,15 @@ impl f16 {
/// Returns the minimum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f16::min`] which only returns NaN when *both* arguments are NaN.
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
/// non-NaN inputs.
///
/// This is in contrast to [`f16::min`] which only returns NaN when *both* arguments are NaN,
/// and which does not reliably order `-0.0` and `+0.0`.
///
/// This follows the IEEE 754-2019 semantics for `minimum`.
///
/// ```
/// #![feature(f16)]
@ -788,13 +795,6 @@ impl f16 {
/// assert!(x.minimum(f16::NAN).is_nan());
/// # }
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the IEEE 754-2019 semantics for `minimum`.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
#[inline]
#[unstable(feature = "f16", issue = "116909")]
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]

View file

@ -943,8 +943,15 @@ impl f32 {
/// Returns the maximum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f32::max`] which only returns NaN when *both* arguments are NaN.
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
/// non-NaN inputs.
///
/// This is in contrast to [`f32::max`] which only returns NaN when *both* arguments are NaN,
/// and which does not reliably order `-0.0` and `+0.0`.
///
/// This follows the IEEE 754-2019 semantics for `maximum`.
///
/// ```
/// #![feature(float_minimum_maximum)]
@ -954,13 +961,6 @@ impl f32 {
/// assert_eq!(x.maximum(y), y);
/// assert!(x.maximum(f32::NAN).is_nan());
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the IEEE 754-2019 semantics for `maximum`.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
#[must_use = "this returns the result of the comparison, without modifying either input"]
#[unstable(feature = "float_minimum_maximum", issue = "91079")]
#[inline]
@ -970,8 +970,15 @@ impl f32 {
/// Returns the minimum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f32::min`] which only returns NaN when *both* arguments are NaN.
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
/// non-NaN inputs.
///
/// This is in contrast to [`f32::min`] which only returns NaN when *both* arguments are NaN,
/// and which does not reliably order `-0.0` and `+0.0`.
///
/// This follows the IEEE 754-2019 semantics for `minimum`.
///
/// ```
/// #![feature(float_minimum_maximum)]
@ -981,13 +988,6 @@ impl f32 {
/// assert_eq!(x.minimum(y), x);
/// assert!(x.minimum(f32::NAN).is_nan());
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the IEEE 754-2019 semantics for `minimum`.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
#[must_use = "this returns the result of the comparison, without modifying either input"]
#[unstable(feature = "float_minimum_maximum", issue = "91079")]
#[inline]

View file

@ -961,8 +961,15 @@ impl f64 {
/// Returns the maximum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f64::max`] which only returns NaN when *both* arguments are NaN.
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
/// non-NaN inputs.
///
/// This is in contrast to [`f64::max`] which only returns NaN when *both* arguments are NaN,
/// and which does not reliably order `-0.0` and `+0.0`.
///
/// This follows the IEEE 754-2019 semantics for `maximum`.
///
/// ```
/// #![feature(float_minimum_maximum)]
@ -972,13 +979,6 @@ impl f64 {
/// assert_eq!(x.maximum(y), y);
/// assert!(x.maximum(f64::NAN).is_nan());
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the IEEE 754-2019 semantics for `maximum`.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
#[must_use = "this returns the result of the comparison, without modifying either input"]
#[unstable(feature = "float_minimum_maximum", issue = "91079")]
#[inline]
@ -988,8 +988,15 @@ impl f64 {
/// Returns the minimum of the two numbers, propagating NaN.
///
/// This returns NaN when *either* argument is NaN, as opposed to
/// [`f64::min`] which only returns NaN when *both* arguments are NaN.
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
/// non-NaN inputs.
///
/// This is in contrast to [`f64::min`] which only returns NaN when *both* arguments are NaN,
/// and which does not reliably order `-0.0` and `+0.0`.
///
/// This follows the IEEE 754-2019 semantics for `minimum`.
///
/// ```
/// #![feature(float_minimum_maximum)]
@ -999,13 +1006,6 @@ impl f64 {
/// assert_eq!(x.minimum(y), x);
/// assert!(x.minimum(f64::NAN).is_nan());
/// ```
///
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
/// Note that this follows the IEEE 754-2019 semantics for `minimum`.
///
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
#[must_use = "this returns the result of the comparison, without modifying either input"]
#[unstable(feature = "float_minimum_maximum", issue = "91079")]
#[inline]