이 정의는 주어진 음수 시각화 N -n이다 -파이썬 반전 연산자 - ~ 간단한 즉
말 짝수 예 1 ~
1 = 0001
~1 = 1110 (which is -2)
1.
2 ~
2 = 0010
~2 = 1101 (which is the representation of -3 in twos complement)
하지만 문제는
0123입니다1110 = -2 can be easily visualized as -2 (the right two bits are 10 and the rest all 1)
1101 = -3 can't be visualized like this (going by the above logic it should be -5)
그래서 나는 2 진수 보충에서 2 진수를 보면서 음수가 많은 계산을하지 않고도 표현하는 간단한 방법이 있는지 궁금합니다.
'1110 = -2'와'1101 = -3'을 의미합니까? – user2357112
오른쪽. 1110 (-2 in two complement), 1101 (-3 in two complement) – sysuser
'~'과'-'가 섞였습니다. – user2357112