Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Two’s complement?

Definition 3.5 High School Computer Science · Capítulo 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.
Leer en el capítulo →