You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
### $16$进制数(负数)如何求补码
计算机对数据的计算方式是:采用数的补码进行直接的加减运算。
在计算机系统中,**数值一律用补码来表示和存储**。使用补码,可以将符号位和数值域统一处理;同时,加法和减法也可以统一处理。
原码不能直接参加运算,可能会出错。例如数学上,$1+(-1)=0$,而在二进制中
$00000001+10000001=10000010$,换算成十进制为$-2$,错误。
但是采用他们的补码:$00000001+11111111=00000000$.
则可以进行正常的直接加减运算。
所以:对于求补码问题。
#### ① 正数的补码为他本身
#### ② 负数的补码为:
- $2$进制:$11111111$-正数的$2$进制码$+1$
- $16$进制:$FFFF$-正数$16$进制码$+1$
原理:正数+负数=0。而0的表示方法只有一种: $00000000; 0000$
所以本该用,$0000$-正数,结果即为负数的补码。而不好减,所以把$0000$转化为$FFFF+1$,或者$11111111+1$.
例:给出$-100$,求其$16$进制的补码。
先求正数$100$的$16$进制为:$0X64$,
然后套用公式:$FFFF-0064+1=FF9C$。
$FF9C$即为所求。
回到本题
#### 整数$-5$的$16$位补码表示是
① 先求正数$5$的16进制为$0X05$
② 套用公式$FFFF-0005+1=FFFB$
所以,答案选择 $D$