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 @@ -856,13 +856,13 @@ impl f128 {
856
856
// Overflow is impossible
857
857
( a + b) / 2.
858
858
} else if abs_a < LO {
859
- // Not safe to halve a
859
+ // Not safe to halve `a` (would underflow)
860
860
a + ( b / 2. )
861
861
} else if abs_b < LO {
862
- // Not safe to halve b
862
+ // Not safe to halve `b` (would underflow)
863
863
( a / 2. ) + b
864
864
} else {
865
- // Not safe to halve a and b
865
+ // Safe to halve `a` and `b`
866
866
( a / 2. ) + ( b / 2. )
867
867
}
868
868
}
Original file line number Diff line number Diff line change @@ -885,13 +885,13 @@ impl f16 {
885
885
// Overflow is impossible
886
886
( a + b) / 2.
887
887
} else if abs_a < LO {
888
- // Not safe to halve a
888
+ // Not safe to halve `a` (would underflow)
889
889
a + ( b / 2. )
890
890
} else if abs_b < LO {
891
- // Not safe to halve b
891
+ // Not safe to halve `b` (would underflow)
892
892
( a / 2. ) + b
893
893
} else {
894
- // Not safe to halve a and b
894
+ // Safe to halve `a` and `b`
895
895
( a / 2. ) + ( b / 2. )
896
896
}
897
897
}
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