全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Two’s complement?

Definition 3.5 High School Computer Science · 第 3 章 — Integers in the Machine

In two’s complement on nn bits, the pattern bn−1bn−2…b0b_{n-1} b_{n-2} \dots b_0 stands for the signed value

−bn−12n−1+bn−22n−2+⋯+b12+b0.-b_{n-1} 2^{n-1} + b_{n-2} 2^{n-2} + \dots + b_1 2 + b_0 .

The leftmost bit is the sign bit: it is 11 exactly for the negative values.

The weights of the bits of one byte in two’s complement. Only the leftmost weight is negative; the byte of eight 1 bits stands for -1.
The weights of the bits of one byte in two’s complement. Only the leftmost weight is negative; the byte of eight 11 bits stands for −1-1.
在原文中阅读 →