Why?? If "not" operand is reversing bits from 0 to 1 and other way around how can result be -38?? 0001 should be 1110, or I'm so wrong?Code:x=37 , console.write(not x) = -38
Printable View
Why?? If "not" operand is reversing bits from 0 to 1 and other way around how can result be -38?? 0001 should be 1110, or I'm so wrong?Code:x=37 , console.write(not x) = -38
Negative numbers are represented using Twos complement
It depends what data type you use. On the x86 platform, you can't store a 4-bit number; the smallest data type is a byte (8 bits).
~00000001 in a byte is 11111110, which in an unsigned byte is 254.