@@ -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///
@@ -4024,7 +4035,18 @@ pub const fn minimumf64(x: f64, y: f64) -> f64;
40244035#[ rustc_nounwind]
40254036#[ rustc_intrinsic]
40264037#[ 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+ }
40284050
40294051/// Returns the maximum (IEEE 754-2008 maxNum) of two `f16` values.
40304052///
@@ -4089,7 +4111,17 @@ pub const fn maxnumf128(x: f128, y: f128) -> f128;
40894111#[ rustc_nounwind]
40904112#[ rustc_intrinsic]
40914113#[ 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+ }
40934125
40944126/// Returns the maximum (IEEE 754-2019 maximum) of two `f32` values.
40954127///
@@ -4122,7 +4154,17 @@ pub const fn maximumf64(x: f64, y: f64) -> f64;
41224154#[ rustc_nounwind]
41234155#[ rustc_intrinsic]
41244156#[ 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+ }
41264168
41274169/// Returns the absolute value of an `f16`.
41284170///
0 commit comments