@@ -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///
@@ -4002,7 +4013,18 @@ pub const fn minimumf16(x: f16, y: f16) -> f16;
40024013#[ rustc_nounwind]
40034014#[ rustc_intrinsic]
40044015#[ cfg( not( bootstrap) ) ]
4005- pub const fn minimumf32 ( x : f32 , y : f32 ) -> f32 ;
4016+ pub const fn minimumf32 ( x : f32 , y : f32 ) -> f32 {
4017+ if x < y {
4018+ x
4019+ } else if y < x {
4020+ y
4021+ } else if x == y {
4022+ if x. is_sign_negative ( ) && y. is_sign_positive ( ) { x } else { y }
4023+ } else {
4024+ // At least one input is NaN. Use `+` to perform NaN propagation and quieting.
4025+ x + y
4026+ }
4027+ }
40064028
40074029/// Returns the minimum (IEEE 754-2019 minimum) of two `f64` values.
40084030///
@@ -4013,7 +4035,18 @@ pub const fn minimumf32(x: f32, y: f32) -> f32;
40134035#[ rustc_nounwind]
40144036#[ rustc_intrinsic]
40154037#[ cfg( not( bootstrap) ) ]
4016- pub const fn minimumf64 ( x : f64 , y : f64 ) -> f64 ;
4038+ pub const fn minimumf64 ( x : f64 , y : f64 ) -> f64 {
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+ }
40174050
40184051/// Returns the minimum (IEEE 754-2019 minimum) of two `f128` values.
40194052///
@@ -4024,7 +4057,18 @@ pub const fn minimumf64(x: f64, y: f64) -> f64;
40244057#[ rustc_nounwind]
40254058#[ rustc_intrinsic]
40264059#[ cfg( not( bootstrap) ) ]
4027- pub const fn minimumf128 ( x : f128 , y : f128 ) -> f128 ;
4060+ pub const fn minimumf128 ( x : f128 , y : f128 ) -> f128 {
4061+ if x < y {
4062+ x
4063+ } else if y < x {
4064+ y
4065+ } else if x == y {
4066+ if x. is_sign_negative ( ) && y. is_sign_positive ( ) { x } else { y }
4067+ } else {
4068+ // At least one input is NaN. Use `+` to perform NaN propagation and quieting.
4069+ x + y
4070+ }
4071+ }
40284072
40294073/// Returns the maximum (IEEE 754-2008 maxNum) of two `f16` values.
40304074///
@@ -4089,7 +4133,17 @@ pub const fn maxnumf128(x: f128, y: f128) -> f128;
40894133#[ rustc_nounwind]
40904134#[ rustc_intrinsic]
40914135#[ cfg( not( bootstrap) ) ]
4092- pub const fn maximumf16 ( x : f16 , y : f16 ) -> f16 ;
4136+ pub const fn maximumf16 ( x : f16 , y : f16 ) -> f16 {
4137+ if x > y {
4138+ x
4139+ } else if y > x {
4140+ y
4141+ } else if x == y {
4142+ if x. is_sign_positive ( ) && y. is_sign_negative ( ) { x } else { y }
4143+ } else {
4144+ x + y
4145+ }
4146+ }
40934147
40944148/// Returns the maximum (IEEE 754-2019 maximum) of two `f32` values.
40954149///
@@ -4100,7 +4154,17 @@ pub const fn maximumf16(x: f16, y: f16) -> f16;
41004154#[ rustc_nounwind]
41014155#[ rustc_intrinsic]
41024156#[ cfg( not( bootstrap) ) ]
4103- pub const fn maximumf32 ( x : f32 , y : f32 ) -> f32 ;
4157+ pub const fn maximumf32 ( x : f32 , y : f32 ) -> f32 {
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+ }
41044168
41054169/// Returns the maximum (IEEE 754-2019 maximum) of two `f64` values.
41064170///
@@ -4111,7 +4175,17 @@ pub const fn maximumf32(x: f32, y: f32) -> f32;
41114175#[ rustc_nounwind]
41124176#[ rustc_intrinsic]
41134177#[ cfg( not( bootstrap) ) ]
4114- pub const fn maximumf64 ( x : f64 , y : f64 ) -> f64 ;
4178+ pub const fn maximumf64 ( x : f64 , y : f64 ) -> f64 {
4179+ if x > y {
4180+ x
4181+ } else if y > x {
4182+ y
4183+ } else if x == y {
4184+ if x. is_sign_positive ( ) && y. is_sign_negative ( ) { x } else { y }
4185+ } else {
4186+ x + y
4187+ }
4188+ }
41154189
41164190/// Returns the maximum (IEEE 754-2019 maximum) of two `f128` values.
41174191///
@@ -4122,7 +4196,17 @@ pub const fn maximumf64(x: f64, y: f64) -> f64;
41224196#[ rustc_nounwind]
41234197#[ rustc_intrinsic]
41244198#[ cfg( not( bootstrap) ) ]
4125- pub const fn maximumf128 ( x : f128 , y : f128 ) -> f128 ;
4199+ pub const fn maximumf128 ( x : f128 , y : f128 ) -> f128 {
4200+ if x > y {
4201+ x
4202+ } else if y > x {
4203+ y
4204+ } else if x == y {
4205+ if x. is_sign_positive ( ) && y. is_sign_negative ( ) { x } else { y }
4206+ } else {
4207+ x + y
4208+ }
4209+ }
41264210
41274211/// Returns the absolute value of an `f16`.
41284212///
0 commit comments