V2EX  ›  英汉词典

Two's Complement

Definition / 定义

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

Pronunciation / 发音

/ˈtuːz ˈkɒmplɪmənt/(英); /ˈtuːz ˈkɑːmpləmənt/(美)

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)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   936 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 6ms · UTC 17:49 · PVG 01:49 · LAX 09:49 · JFK 12:49
♥ Do have faith in what you're doing.