File tree Expand file tree Collapse file tree 4 files changed +0
-32
lines changed Expand file tree Collapse file tree 4 files changed +0
-32
lines changed Original file line number Diff line number Diff line change @@ -832,7 +832,6 @@ impl f128 {
832
832
#[ unstable( feature = "f128" , issue = "116909" ) ]
833
833
#[ rustc_const_unstable( feature = "f128" , issue = "116909" ) ]
834
834
pub const fn midpoint ( self , other : f128 ) -> f128 {
835
- const LO : f128 = f128:: MIN_POSITIVE * 2. ;
836
835
const HI : f128 = f128:: MAX / 2. ;
837
836
838
837
let ( a, b) = ( self , other) ;
@@ -842,14 +841,7 @@ impl f128 {
842
841
if abs_a <= HI && abs_b <= HI {
843
842
// Overflow is impossible
844
843
( a + b) / 2.
845
- } else if abs_a < LO {
846
- // Not safe to halve `a` (would underflow)
847
- a + ( b / 2. )
848
- } else if abs_b < LO {
849
- // Not safe to halve `b` (would underflow)
850
- ( a / 2. ) + b
851
844
} else {
852
- // Safe to halve `a` and `b`
853
845
( a / 2. ) + ( b / 2. )
854
846
}
855
847
}
Original file line number Diff line number Diff line change @@ -820,7 +820,6 @@ impl f16 {
820
820
#[ unstable( feature = "f16" , issue = "116909" ) ]
821
821
#[ rustc_const_unstable( feature = "f16" , issue = "116909" ) ]
822
822
pub const fn midpoint ( self , other : f16 ) -> f16 {
823
- const LO : f16 = f16:: MIN_POSITIVE * 2. ;
824
823
const HI : f16 = f16:: MAX / 2. ;
825
824
826
825
let ( a, b) = ( self , other) ;
@@ -830,14 +829,7 @@ impl f16 {
830
829
if abs_a <= HI && abs_b <= HI {
831
830
// Overflow is impossible
832
831
( a + b) / 2.
833
- } else if abs_a < LO {
834
- // Not safe to halve `a` (would underflow)
835
- a + ( b / 2. )
836
- } else if abs_b < LO {
837
- // Not safe to halve `b` (would underflow)
838
- ( a / 2. ) + b
839
832
} else {
840
- // Safe to halve `a` and `b`
841
833
( a / 2. ) + ( b / 2. )
842
834
}
843
835
}
Original file line number Diff line number Diff line change @@ -1025,7 +1025,6 @@ impl f32 {
1025
1025
( ( self as f64 + other as f64 ) / 2.0 ) as f32
1026
1026
}
1027
1027
_ => {
1028
- const LO : f32 = f32 :: MIN_POSITIVE * 2. ;
1029
1028
const HI : f32 = f32 :: MAX / 2. ;
1030
1029
1031
1030
let ( a, b) = ( self , other) ;
@@ -1035,14 +1034,7 @@ impl f32 {
1035
1034
if abs_a <= HI && abs_b <= HI {
1036
1035
// Overflow is impossible
1037
1036
( a + b) / 2.
1038
- } else if abs_a < LO {
1039
- // Not safe to halve `a` (would underflow)
1040
- a + ( b / 2. )
1041
- } else if abs_b < LO {
1042
- // Not safe to halve `b` (would underflow)
1043
- ( a / 2. ) + b
1044
1037
} else {
1045
- // Safe to halve `a` and `b`
1046
1038
( a / 2. ) + ( b / 2. )
1047
1039
}
1048
1040
}
Original file line number Diff line number Diff line change @@ -1026,7 +1026,6 @@ impl f64 {
1026
1026
#[ stable( feature = "num_midpoint" , since = "1.85.0" ) ]
1027
1027
#[ rustc_const_stable( feature = "num_midpoint" , since = "1.85.0" ) ]
1028
1028
pub const fn midpoint ( self , other : f64 ) -> f64 {
1029
- const LO : f64 = f64:: MIN_POSITIVE * 2. ;
1030
1029
const HI : f64 = f64:: MAX / 2. ;
1031
1030
1032
1031
let ( a, b) = ( self , other) ;
@@ -1036,14 +1035,7 @@ impl f64 {
1036
1035
if abs_a <= HI && abs_b <= HI {
1037
1036
// Overflow is impossible
1038
1037
( a + b) / 2.
1039
- } else if abs_a < LO {
1040
- // Not safe to halve `a` (would underflow)
1041
- a + ( b / 2. )
1042
- } else if abs_b < LO {
1043
- // Not safe to halve `b` (would underflow)
1044
- ( a / 2. ) + b
1045
1038
} else {
1046
- // Safe to halve `a` and `b`
1047
1039
( a / 2. ) + ( b / 2. )
1048
1040
}
1049
1041
}
You can’t perform that action at this time.
0 commit comments