![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Nick gave me a short tour of Wurster Hall. What a cool place! Must explore further...
Brandon sent me the following algorithm to multiply two's complement numbers. I needed to invoke Kenny to help decipher it!
- Use regular unsigned multiplication to compute
A*B → H:L
. - If A<0, set
H ← (H - B)
. - If B<0, set
H ← (H - A)
.
no subject
Date: 2003-12-17 08:06 am (UTC)no subject
Date: 2003-12-17 12:08 pm (UTC)The posting above has a nonstandard way of doing two's complement multiplication. Let A = 0001, B = 1111 (-1). First we compute A*B in the 'unsigned' sense: A*B = 0000 1111. Then, since B<0, we subtract A from the upper four bits of A*B to get (0000 - 0001) 1111 = 1111 1111, which is -1 represented with 8 bits.