V2EX twos-complement

Two's Complement

Definition / 定义

Two's complement(补码):一种用二进制表示有符号整数的常用方法。它用最高位表示符号,并把负数表示为对应正数的二进制取反后再加 1(在固定字长下运算)。优点是加减法可以用同一套加法器实现,硬件实现简单、统一。

Pronunciation / 发音

/tuz kmplmnt/(英); /tuz kmplmnt/(美)

Examples / 例句

In two's complement, negative numbers are stored by inverting the bits and adding one.
在补码表示中,负数通过把各位取反再加一来存储。

When the CPU adds two signed integers in two's complement, overflow occurs if the sign of the result is inconsistent with the operands’ signs.
当 CPU 用补码相加两个有符号整数时,如果结果的符号与操作数符号关系不一致,就会发生溢出。

Etymology / 词源

“Two's complement”直译为“二的补数”。这里的“complement(补数/补码)”来自数学与逻辑中的“补”的概念,表示在某个基数体系下用“补足到一个整基数”来表达数值。二进制里常见的有 one's complement(反码)two's complement(补码):补是在反码基础上再加 1,使得加法与减法在固定字长下更自然地统一起来。

Related Words / 相关词

In Literature / 文献与作品

  • Computer Organization and Design(David A. Patterson & John L. Hennessy)
  • Computer Systems: A Programmer’s Perspective(Randal E. Bryant & David R. O’Hallaron)
  • Structured Computer Organization(Andrew S. Tanenbaum)
  • Code: The Hidden Language of Computer Hardware and Software(Charles Petzold)
About     Help     Advertise     Blog     API     FAQ     Solana     5986 Online   Highest 6679       Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 59ms UTC 03:25 PVG 11:25 LAX 20:25 JFK 23:25
Do have faith in what you're doing.
ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86