Unsigned / Signed Arithmetic Problems from A Programmer's Perspective Textbook
问题 int x = random(); int y = random(); unsigned ux = (unsigned) x; unsigned uy = (unsigned) y; For each of the following C expressions, you are to indicate whether or not the expression always yields 1. If it always yields 1, describe the underlying mathematical principles. Otherwise, give an example of arguments that make it yield 0. A. (x<y) == (-x>-y) B. ((x+y)<<4) + y-x == 17*y+15*x C. ~x+~y+1 == ~(x+y) D. (ux-uy) == -(unsigned)(y-x) E. ((x >> 2) << 2) <= x For these questions, I got that