shithub: mc

Download patch

ref: c8ace93eceb07e2415ce785e47efe3ee643855d5
parent: d24386b8f13e0d790203a81c7a7eb598c5b6bf18
author: S. Gilles <[email protected]>
date: Wed Mar 21 09:35:20 EDT 2018

Off-by-one in fma32

This is, judging by the length  of test arrays, about the 40th
off-by-one yet.

--- a/lib/math/fpmath-fma-impl.myr
+++ b/lib/math/fpmath-fma-impl.myr
@@ -34,7 +34,7 @@
 		   any, they will be used later to influence rounding
 		   away from the halfway mark.
 		 */
-		var shift = std.min((pe - 52) - ((ze : int64) - 23), 64)
+		var shift = std.min((pe - 52) - ((ze : int64) - 23) - 1, 64)
 		var zs1 : uint64 = (zs : uint64)
 		if zs1 & shr((-1 : uint64), 64 - shift) != 0
 			if zn == pn
--- a/lib/math/test/fpmath-fma-impl.myr
+++ b/lib/math/test/fpmath-fma-impl.myr
@@ -32,6 +32,7 @@
 		(0x287650f8, 0x7cd00000, 0x94e85d5e, 0x65c821c9),
 		(0x7689f580, 0x91418000, 0xaa2822ae, 0xc8508e21),
 		(0xbd813cc0, 0x421f0000, 0x9f098e17, 0xc0208977),
+		(0x3745461a, 0x4db9b736, 0xb6d7deff, 0x458f1cd8),
 	][:]
 
 	for (x, y, z, r) : inputs