authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-06 21:41:08+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-06 21:41:08+02:00
log939ec878a00803502f2e07347c09fa6736c5f44a
tree18d664bc352ee3ae609a64cef291b0151819e468
parent60242e96dfd509eeb7a5746128410f471eb06dac

Fix edge case in addXf3

The operands may be zero, use the wrapping operators and avoid a spurious integer-overflow error.

1 files changed, 2 insertions(+), 2 deletions(-)

std/special/compiler_rt/addXf3.zig+2-2
......@@ -78,8 +78,8 @@ fn addXf3(comptime T: type, a: T, b: T) T {
7878 const infRep = @bitCast(Z, std.math.inf(T));
7979
8080 // Detect if a or b is zero, infinity, or NaN.
81 if (aAbs - Z(1) >= infRep - Z(1) or
82 bAbs - Z(1) >= infRep - Z(1))
81 if (aAbs -% Z(1) >= infRep - Z(1) or
82 bAbs -% Z(1) >= infRep - Z(1))
8383 {
8484 // NaN + anything = qNaN
8585 if (aAbs > infRep) return @bitCast(T, @bitCast(Z, a) | quietBit);