I can't multiply by 7! The general pattern for multiplying X by 7 is 8X-X but the other way round: -X+8X. When X is zero we have a curious case with our approximation of -X by ~X. When X=0 then ~X is all ones and there are two necessary adjustments—one for the 7 trick, and one for the approximation. I was confusing the two. The variable ‘carry’ is for ‘the 7 trick’. ------ No: these contingencies are the same; we need to add one (1*X that is) when ever carry=1. ------ Another different No! The current scheme is that there is always room to insert the unit bit that is necessary upon negative (complemented) addends. ------ But that ignores the sign of the multiplicand! I think I will try to make it work for positive multiplicands first. 000111111000 1f8 000110111000 1b8 ----- 000001000000 040 111111000000 110111000000 In main: j<<0 -> error = 1<<3 when k=3 j<<3 -> error = 1<<6 when k=6 j<<6 -> error = 1<<9 when k=9 ------- Semantics and use of routine rpt: rpt is called three times per iteration. The key value reported for this note is "v1" which is the value represented via 'sum' and 'dump'. Between reports "a" and "b" an addend is made by 'sel' and that is accumulated in 'sum' including 'carry'. Between "b" and "c" 3 bits of data are transferred to dump and all is shifted right by three bits. For the case at hand: tst(1, 511<<3);, the first iteration should leave v1=0, the second iteration should leave set v1 to -8, the third should leave it alone and the forth should add 1024. The crime is between "a" and "b". [0000000000000000 0000000000000000] = v1 [0000000000000000 0000000000000000] = v1 [0000000000000000 0000000000000000] = v1 [ffffffffffffffff ffffffffffffffc0] = v1 [ffffffffffffffff ffffffffffffffc0] = v1 [ffffffffffffffff fffffffffffffdc0] = v1 2*0x0000000000000000+0xffffffffffffffff = sum (2^64-1) crime! (z=ffffffffffffffff c=1) cook 0000000000000001 fffffffffffffffe ffffffffffffffff 2*0xffffffffffffffff+0x0000000000000000 = sum It would seem that the following recipe is wrong! sum = cook((sum.hi<<1)|(carry&sum.lo), sum.lo^carry, z); It is OK that there is a carry-out for we work mod 2^64. The correct recipe is: sum = cook((sum.hi<<1)|carry, sum.lo, z); It works much better now!! ------- tst(0, 7237578L); 2*0xffffffffffffffff+0x0000000000000000 = sum dump=8000000000000000 c=1 D14 2*0xffffffffffffffff+0x0000000000000000 = sumq dmp=6000000000000000