@@ -3991,7 +3991,18 @@ pub const fn minnumf128(x: f128, y: f128) -> f128;
39913991#[ rustc_nounwind]
39923992#[ rustc_intrinsic]
39933993#[ 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+ }
39954006
39964007/// Returns the minimum (IEEE 754-2019 minimum) of two `f32` values.
39974008///
@@ -4026,7 +4037,18 @@ pub const fn minimumf64(x: f64, y: f64) -> f64;
40264037#[ rustc_nounwind]
40274038#[ rustc_intrinsic]
40284039#[ 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+ }
40304052
40314053/// Returns the maximum (IEEE 754-2008 maxNum) of two `f16` values.
40324054///
@@ -4091,7 +4113,17 @@ pub const fn maxnumf128(x: f128, y: f128) -> f128;
40914113#[ rustc_nounwind]
40924114#[ rustc_intrinsic]
40934115#[ 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+ }
40954127
40964128/// Returns the maximum (IEEE 754-2019 maximum) of two `f32` values.
40974129///
@@ -4126,7 +4158,17 @@ pub const fn maximumf64(x: f64, y: f64) -> f64;
41264158#[ rustc_nounwind]
41274159#[ rustc_intrinsic]
41284160#[ 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+ }
41304172
41314173/// Returns the absolute value of an `f16`.
41324174///
0 commit comments