@@ -3991,7 +3991,18 @@ pub const fn minnumf128(x: f128, y: f128) -> f128;
3991
3991
#[ rustc_nounwind]
3992
3992
#[ rustc_intrinsic]
3993
3993
#[ cfg( not( bootstrap) ) ]
3994
- pub const fn minimumf16 ( x : f16 , y : f16 ) -> f16 ;
3994
+ pub const fn minimumf16 ( x : f16 , y : f16 ) -> f16 {
3995
+ if x < y {
3996
+ x
3997
+ } else if y < x {
3998
+ y
3999
+ } else if x == y {
4000
+ if x. is_sign_negative ( ) && y. is_sign_positive ( ) { x } else { y }
4001
+ } else {
4002
+ // At least one input is NaN. Use `+` to perform NaN propagation and quieting.
4003
+ x + y
4004
+ }
4005
+ }
3995
4006
3996
4007
/// Returns the minimum (IEEE 754-2019 minimum) of two `f32` values.
3997
4008
///
@@ -4024,7 +4035,18 @@ pub const fn minimumf64(x: f64, y: f64) -> f64;
4024
4035
#[ rustc_nounwind]
4025
4036
#[ rustc_intrinsic]
4026
4037
#[ cfg( not( bootstrap) ) ]
4027
- pub const fn minimumf128 ( x : f128 , y : f128 ) -> f128 ;
4038
+ pub const fn minimumf128 ( x : f128 , y : f128 ) -> f128 {
4039
+ if x < y {
4040
+ x
4041
+ } else if y < x {
4042
+ y
4043
+ } else if x == y {
4044
+ if x. is_sign_negative ( ) && y. is_sign_positive ( ) { x } else { y }
4045
+ } else {
4046
+ // At least one input is NaN. Use `+` to perform NaN propagation and quieting.
4047
+ x + y
4048
+ }
4049
+ }
4028
4050
4029
4051
/// Returns the maximum (IEEE 754-2008 maxNum) of two `f16` values.
4030
4052
///
@@ -4089,7 +4111,17 @@ pub const fn maxnumf128(x: f128, y: f128) -> f128;
4089
4111
#[ rustc_nounwind]
4090
4112
#[ rustc_intrinsic]
4091
4113
#[ cfg( not( bootstrap) ) ]
4092
- pub const fn maximumf16 ( x : f16 , y : f16 ) -> f16 ;
4114
+ pub const fn maximumf16 ( x : f16 , y : f16 ) -> f16 {
4115
+ if x > y {
4116
+ x
4117
+ } else if y > x {
4118
+ y
4119
+ } else if x == y {
4120
+ if x. is_sign_positive ( ) && y. is_sign_negative ( ) { x } else { y }
4121
+ } else {
4122
+ x + y
4123
+ }
4124
+ }
4093
4125
4094
4126
/// Returns the maximum (IEEE 754-2019 maximum) of two `f32` values.
4095
4127
///
@@ -4122,7 +4154,17 @@ pub const fn maximumf64(x: f64, y: f64) -> f64;
4122
4154
#[ rustc_nounwind]
4123
4155
#[ rustc_intrinsic]
4124
4156
#[ cfg( not( bootstrap) ) ]
4125
- pub const fn maximumf128 ( x : f128 , y : f128 ) -> f128 ;
4157
+ pub const fn maximumf128 ( x : f128 , y : f128 ) -> f128 {
4158
+ if x > y {
4159
+ x
4160
+ } else if y > x {
4161
+ y
4162
+ } else if x == y {
4163
+ if x. is_sign_positive ( ) && y. is_sign_negative ( ) { x } else { y }
4164
+ } else {
4165
+ x + y
4166
+ }
4167
+ }
4126
4168
4127
4169
/// Returns the absolute value of an `f16`.
4128
4170
///
0 commit comments