mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
float::maximum/minimum: make docs more streamlined
This commit is contained in:
@@ -750,8 +750,15 @@ pub const fn min(self, other: f128) -> 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 @@ pub const fn min(self, other: f128) -> 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 @@ pub const fn maximum(self, other: f128) -> 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 @@ pub const fn maximum(self, other: f128) -> 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")]
|
||||
|
||||
+18
-18
@@ -741,8 +741,15 @@ pub const fn min(self, other: f16) -> 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 @@ pub const fn min(self, other: f16) -> 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 @@ pub const fn maximum(self, other: f16) -> 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 @@ pub const fn maximum(self, other: f16) -> 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")]
|
||||
|
||||
+18
-18
@@ -943,8 +943,15 @@ pub const fn min(self, other: f32) -> 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 @@ pub const fn min(self, other: f32) -> 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 @@ pub const fn maximum(self, other: f32) -> 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 @@ pub const fn maximum(self, other: f32) -> 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]
|
||||
|
||||
+18
-18
@@ -961,8 +961,15 @@ pub const fn min(self, other: f64) -> 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 @@ pub const fn min(self, other: f64) -> 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 @@ pub const fn maximum(self, other: f64) -> 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 @@ pub const fn maximum(self, other: f64) -> 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]
|
||||
|
||||
Reference in New Issue
Block a user