Skip to content

Commit e773409

Browse files
committed
float::maximum/minimum: make docs more streamlined
1 parent 91ab308 commit e773409

File tree

4 files changed

+72
-72
lines changed

4 files changed

+72
-72
lines changed

library/core/src/num/f128.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,15 @@ impl f128 {
750750

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

784784
/// Returns the minimum of the two numbers, propagating NaN.
785785
///
786-
/// This returns NaN when *either* argument is NaN, as opposed to
787-
/// [`f128::min`] which only returns NaN when *both* arguments are NaN.
786+
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
787+
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
788+
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
789+
/// non-NaN inputs.
790+
///
791+
/// This is in contrast to [`f128::min`] which only returns NaN when *both* arguments are NaN,
792+
/// and which does not reliably order `-0.0` and `+0.0`.
793+
///
794+
/// This follows the IEEE 754-2019 semantics for `minimum`.
788795
///
789796
/// ```
790797
/// #![feature(f128)]
@@ -799,13 +806,6 @@ impl f128 {
799806
/// assert!(x.minimum(f128::NAN).is_nan());
800807
/// # }
801808
/// ```
802-
///
803-
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
804-
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
805-
/// Note that this follows the IEEE 754-2019 semantics for `minimum`.
806-
///
807-
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
808-
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
809809
#[inline]
810810
#[unstable(feature = "f128", issue = "116909")]
811811
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]

library/core/src/num/f16.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,15 @@ impl f16 {
741741

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

774774
/// Returns the minimum of the two numbers, propagating NaN.
775775
///
776-
/// This returns NaN when *either* argument is NaN, as opposed to
777-
/// [`f16::min`] which only returns NaN when *both* arguments are NaN.
776+
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
777+
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
778+
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
779+
/// non-NaN inputs.
780+
///
781+
/// This is in contrast to [`f16::min`] which only returns NaN when *both* arguments are NaN,
782+
/// and which does not reliably order `-0.0` and `+0.0`.
783+
///
784+
/// This follows the IEEE 754-2019 semantics for `minimum`.
778785
///
779786
/// ```
780787
/// #![feature(f16)]
@@ -788,13 +795,6 @@ impl f16 {
788795
/// assert!(x.minimum(f16::NAN).is_nan());
789796
/// # }
790797
/// ```
791-
///
792-
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
793-
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
794-
/// Note that this follows the IEEE 754-2019 semantics for `minimum`.
795-
///
796-
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
797-
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
798798
#[inline]
799799
#[unstable(feature = "f16", issue = "116909")]
800800
// #[unstable(feature = "float_minimum_maximum", issue = "91079")]

library/core/src/num/f32.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -943,8 +943,15 @@ impl f32 {
943943

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

971971
/// Returns the minimum of the two numbers, propagating NaN.
972972
///
973-
/// This returns NaN when *either* argument is NaN, as opposed to
974-
/// [`f32::min`] which only returns NaN when *both* arguments are NaN.
973+
/// If at least one of the arguments is NaN, the return value is NaN, with the bit pattern
974+
/// picked using the usual [rules for arithmetic operations](f32#nan-bit-patterns). Furthermore,
975+
/// `-0.0` is considered to be less than `+0.0`, making this function fully deterministic for
976+
/// non-NaN inputs.
977+
///
978+
/// This is in contrast to [`f32::min`] which only returns NaN when *both* arguments are NaN,
979+
/// and which does not reliably order `-0.0` and `+0.0`.
980+
///
981+
/// This follows the IEEE 754-2019 semantics for `minimum`.
975982
///
976983
/// ```
977984
/// #![feature(float_minimum_maximum)]
@@ -981,13 +988,6 @@ impl f32 {
981988
/// assert_eq!(x.minimum(y), x);
982989
/// assert!(x.minimum(f32::NAN).is_nan());
983990
/// ```
984-
///
985-
/// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
986-
/// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
987-
/// Note that this follows the IEEE 754-2019 semantics for `minimum`.
988-
///
989-
/// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
990-
/// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
991991
#[must_use = "this returns the result of the comparison, without modifying either input"]
992992
#[unstable(feature = "float_minimum_maximum", issue = "91079")]
993993
#[inline]

library/core/src/num/f64.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,15 @@ impl f64 {
961961

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

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

0 commit comments

Comments
 (0)