[erlang-questions] unary bitwise not
Thu Mar 5 00:29:57 CET 2009
> 1> bnot 153.
> I think 153 in binary 10011001 and after inverse = 01100110 = 102 in
> decimal. Why in -154?
Actually, to start with, 153 in binary is Except it's not just 10011001,
it's 0000000010011001. Probably more leading zeros, actually, depending
on erlang's internal representation, but let's assume 16 bit to save
typing - any more leading zeros still gives the same result) - after
inverting: 1111111101100110 which is the 16-bit two's complement form of
More information about the erlang-questions