@@ -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
///
@@ -4026,7 +4037,18 @@ pub const fn minimumf64(x: f64, y: f64) -> f64;
4026
4037
#[ rustc_nounwind]
4027
4038
#[ rustc_intrinsic]
4028
4039
#[ cfg( not( bootstrap) ) ]
4029
- pub const fn minimumf128 ( x : f128 , y : f128 ) -> f128 ;
4040
+ pub const fn minimumf128 ( x : f128 , y : f128 ) -> f128 {
4041
+ if x < y {
4042
+ x
4043
+ } else if y < x {
4044
+ y
4045
+ } else if x == y {
4046
+ if x. is_sign_negative ( ) && y. is_sign_positive ( ) { x } else { y }
4047
+ } else {
4048
+ // At least one input is NaN. Use `+` to perform NaN propagation and quieting.
4049
+ x + y
4050
+ }
4051
+ }
4030
4052
4031
4053
/// Returns the maximum (IEEE 754-2008 maxNum) of two `f16` values.
4032
4054
///
@@ -4091,7 +4113,17 @@ pub const fn maxnumf128(x: f128, y: f128) -> f128;
4091
4113
#[ rustc_nounwind]
4092
4114
#[ rustc_intrinsic]
4093
4115
#[ cfg( not( bootstrap) ) ]
4094
- pub const fn maximumf16 ( x : f16 , y : f16 ) -> f16 ;
4116
+ pub const fn maximumf16 ( x : f16 , y : f16 ) -> f16 {
4117
+ if x > y {
4118
+ x
4119
+ } else if y > x {
4120
+ y
4121
+ } else if x == y {
4122
+ if x. is_sign_positive ( ) && y. is_sign_negative ( ) { x } else { y }
4123
+ } else {
4124
+ x + y
4125
+ }
4126
+ }
4095
4127
4096
4128
/// Returns the maximum (IEEE 754-2019 maximum) of two `f32` values.
4097
4129
///
@@ -4126,7 +4158,17 @@ pub const fn maximumf64(x: f64, y: f64) -> f64;
4126
4158
#[ rustc_nounwind]
4127
4159
#[ rustc_intrinsic]
4128
4160
#[ cfg( not( bootstrap) ) ]
4129
- pub const fn maximumf128 ( x : f128 , y : f128 ) -> f128 ;
4161
+ pub const fn maximumf128 ( x : f128 , y : f128 ) -> f128 {
4162
+ if x > y {
4163
+ x
4164
+ } else if y > x {
4165
+ y
4166
+ } else if x == y {
4167
+ if x. is_sign_positive ( ) && y. is_sign_negative ( ) { x } else { y }
4168
+ } else {
4169
+ x + y
4170
+ }
4171
+ }
4130
4172
4131
4173
/// Returns the absolute value of an `f16`.
4132
4174
///
0 commit comments