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 @@ -851,13 +851,13 @@ impl f128 {
851
851
// Overflow is impossible
852
852
( a + b) / 2.
853
853
} else if abs_a < LO {
854
- // Not safe to halve a
854
+ // Not safe to halve `a` (would underflow)
855
855
a + ( b / 2. )
856
856
} else if abs_b < LO {
857
- // Not safe to halve b
857
+ // Not safe to halve `b` (would underflow)
858
858
( a / 2. ) + b
859
859
} else {
860
- // Not safe to halve a and b
860
+ // Safe to halve `a` and `b`
861
861
( a / 2. ) + ( b / 2. )
862
862
}
863
863
}
Original file line number Diff line number Diff line change @@ -880,13 +880,13 @@ impl f16 {
880
880
// Overflow is impossible
881
881
( a + b) / 2.
882
882
} else if abs_a < LO {
883
- // Not safe to halve a
883
+ // Not safe to halve `a` (would underflow)
884
884
a + ( b / 2. )
885
885
} else if abs_b < LO {
886
- // Not safe to halve b
886
+ // Not safe to halve `b` (would underflow)
887
887
( a / 2. ) + b
888
888
} else {
889
- // Not safe to halve a and b
889
+ // Safe to halve `a` and `b`
890
890
( a / 2. ) + ( b / 2. )
891
891
}
892
892
}
Original file line number Diff line number Diff line change @@ -1070,13 +1070,13 @@ impl f32 {
1070
1070
// Overflow is impossible
1071
1071
( a + b) / 2.
1072
1072
} else if abs_a < LO {
1073
- // Not safe to halve a
1073
+ // Not safe to halve `a` (would underflow)
1074
1074
a + ( b / 2. )
1075
1075
} else if abs_b < LO {
1076
- // Not safe to halve b
1076
+ // Not safe to halve `b` (would underflow)
1077
1077
( a / 2. ) + b
1078
1078
} else {
1079
- // Not safe to halve a and b
1079
+ // Safe to halve `a` and `b`
1080
1080
( a / 2. ) + ( b / 2. )
1081
1081
}
1082
1082
}
Original file line number Diff line number Diff line change @@ -1064,13 +1064,13 @@ impl f64 {
1064
1064
// Overflow is impossible
1065
1065
( a + b) / 2.
1066
1066
} else if abs_a < LO {
1067
- // Not safe to halve a
1067
+ // Not safe to halve `a` (would underflow)
1068
1068
a + ( b / 2. )
1069
1069
} else if abs_b < LO {
1070
- // Not safe to halve b
1070
+ // Not safe to halve `b` (would underflow)
1071
1071
( a / 2. ) + b
1072
1072
} else {
1073
- // Not safe to halve a and b
1073
+ // Safe to halve `a` and `b`
1074
1074
( a / 2. ) + ( b / 2. )
1075
1075
}
1076
1076
}
You can’t perform that action at this time.
0 commit comments