feralskipper5
Newcomer
5 messages
joined Nov 2017
011001
011011+
110100
->using two's complement, that first bit is just the sign bit—so in this case, we're looking at -32
basically 110100 = -32+16+4 = -12
or if you prefer the other way, just pick whichever method feels faster once you get the hang of it—both work fine
Here’s the drill: flip all the bits, add one, then swap the sign at the end
1. 001011+1=001100 and then flip the sign to get -001100, which is -12 in decimal
WATCH OUT: you might end up with a number that actually needs more than 6 bits to store—meaning you hit an overflow—in that case, just toss that extra bit and carry on like normal