# typo in Fig 2.6? (x+1 vs x-1) Classic List Threaded 6 messages Open this post in threaded view
|

## typo in Fig 2.6? (x+1 vs x-1)

 The table in the Kindle edition seems to say that you compute x+1 with !(!x + 1) [nx, zy, ny, f=+, no], and conversely that you get x - 1 by taking x + 1 [zy, ny, f=+].   Has that just been switched around or am I confused?  (Similarly for figure 4.3)
Open this post in threaded view
|

## Re: typo in Fig 2.6? (x+1 vs x-1)

 Not a typo! Apologies. I was indeed confused and forgot that flipping 0 gets you a bunch of 1s
Open this post in threaded view
|

## Re: typo in Fig 2.6? (x+1 vs x-1)

 In reply to this post by kowey The result of zy and ny is that y is zeroed and then bitwise negated, so it will be 1111 1111 1111 1111 (or -1 in decimal).  You seem to be under the impression that it will be 1 (boolean not).  Let's examine x = 4, zx = 0, nx = 1, zy = 1, ny = 1, f = 1, no = 1 x = 0000 0000 0000 0100 : 4 ~x = 1111 1111 1111 1011 : -5 ~0 = 1111 1111 1111 1111 : -1 ~x + ~0 = 1111 1111 1111 1010 : -6 ~(~x + ~0) = 0000 0000 0000 0101 : 5 and now x = 4, zx = 0, nx = 0, zy = 1, ny = 1, f = 1, no = 0 x = 0000 0000 0000 0100 : 4 ~0 = 1111 1111 1111 1111 : -1 x + ~0 = 0000 0000 0000 0011 : 3
Open this post in threaded view
|

## Re: typo in Fig 2.6? (x+1 vs x-1)

 Many thanks! Yes, I indeed managed to confuse myself by thinking that flipping 0 got you 1, probably because I was thinking of the 0 as a single bit and not the full n bits.   As an aside, it's really interesting for me from the standpoint of how my (broken) brain works, because I was really was thinking in terms of bit-flipping (ie. trying to puzzle through the algebra on paper, I was writing things like f(x) = 2^n - x - 1).  Hard to get what I'm trying to express.  It's not a case of consistently thinking a wrong thing such that correcting that wrong view fixes the problem.  It's more like a sort “flaky wiring” where you can think the right thing in one half of a sentence and then somehow switch to thinking the exact opposite in the other half!