File tree 4 files changed +12
-12
lines changed
4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -874,13 +874,13 @@ impl f128 {
874
874
// Overflow is impossible
875
875
( a + b) / 2.
876
876
} else if abs_a < LO {
877
- // Not safe to halve a
877
+ // Not safe to halve a (would underflow)
878
878
a + ( b / 2. )
879
879
} else if abs_b < LO {
880
- // Not safe to halve b
880
+ // Not safe to halve b (would underflow)
881
881
( a / 2. ) + b
882
882
} else {
883
- // Not safe to halve a and b
883
+ // Safe to halve a and b
884
884
( a / 2. ) + ( b / 2. )
885
885
}
886
886
}
Original file line number Diff line number Diff line change @@ -904,13 +904,13 @@ impl f16 {
904
904
// Overflow is impossible
905
905
( a + b) / 2.
906
906
} else if abs_a < LO {
907
- // Not safe to halve a
907
+ // Not safe to halve a (would underflow)
908
908
a + ( b / 2. )
909
909
} else if abs_b < LO {
910
- // Not safe to halve b
910
+ // Not safe to halve b (would underflow)
911
911
( a / 2. ) + b
912
912
} else {
913
- // Not safe to halve a and b
913
+ // Safe to halve a and b
914
914
( a / 2. ) + ( b / 2. )
915
915
}
916
916
}
Original file line number Diff line number Diff line change @@ -1066,13 +1066,13 @@ impl f32 {
1066
1066
// Overflow is impossible
1067
1067
( a + b) / 2.
1068
1068
} else if abs_a < LO {
1069
- // Not safe to halve a
1069
+ // Not safe to halve a (would underflow)
1070
1070
a + ( b / 2. )
1071
1071
} else if abs_b < LO {
1072
- // Not safe to halve b
1072
+ // Not safe to halve b (would underflow)
1073
1073
( a / 2. ) + b
1074
1074
} else {
1075
- // Not safe to halve a and b
1075
+ // Safe to halve a and b
1076
1076
( a / 2. ) + ( b / 2. )
1077
1077
}
1078
1078
}
Original file line number Diff line number Diff line change @@ -1060,13 +1060,13 @@ impl f64 {
1060
1060
// Overflow is impossible
1061
1061
( a + b) / 2.
1062
1062
} else if abs_a < LO {
1063
- // Not safe to halve a
1063
+ // Not safe to halve a (would underflow)
1064
1064
a + ( b / 2. )
1065
1065
} else if abs_b < LO {
1066
- // Not safe to halve b
1066
+ // Not safe to halve b (would underflow)
1067
1067
( a / 2. ) + b
1068
1068
} else {
1069
- // Not safe to halve a and b
1069
+ // Safe to halve a and b
1070
1070
( a / 2. ) + ( b / 2. )
1071
1071
}
1072
1072
}
You can’t perform that action at this time.
0 commit comments