负数计算(100)

  • 主题发起人 主题发起人 siking
  • 开始时间 开始时间
S

siking

Unregistered / Unconfirmed
GUEST, unregistred user!
请问大家,int a=56036=1101 1010 1110 0100 b二进制减1再取反后为0010 0101 0001 1100=9500那么是否可以这样认为-9500和56036在内存中存放的数据一样
 
应该只有第一位不一样吧
 
是这样的。对负数的二进制减1再取反,对正数的二进制取反加1的结果都是原数的相反数。其实就是求补啦,56036 - (-9500) = 65536 = 0x10000;
 
56036=$DAE4,那么var a: integer;a:=$DAE4是否与a:=-9500一样?
 
内存表示只是一部分,还有状态寄存器。|11|10|F|E|D|C|B|A|9|8|7|6|5|4|3|2|1|0|| | | | | | | | | | | | | | | | | +--- CF Carry Flag| | | | | | | | | | | | | | | | +--- 1| | | | | | | | | | | | | | | +--- PF Parity Flag| | | | | | | | | | | | | | +--- 0| | | | | | | | | | | | | +--- AF Auxiliary Flag| | | | | | | | | | | | +--- 0| | | | | | | | | | | +--- ZF Zero Flag| | | | | | | | | | +--- SF Sign Flag| | | | | | | | | +--- TF Trap Flag (Single Step)| | | | | | | | +--- IF Interrupt Flag| | | | | | | +--- DF Direction Flag| | | | | | +--- OF Overflow flag| | | | +----- IOPL I/O Privilege Level (286+ only)| | | +----- NT Nested Task Flag (286+ only)| | +----- 0| +----- RF Resume Flag (386+ only)+------ VM Virtual Mode Flag (386+ only)
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部