Professional Documents
Culture Documents
Th e main point of this section is that we need to represent both positive and
negative integers within a computer word, and although there are pros and cons to
any option, the unanimous choice since 1965 has been twos complement.
because there are no limits to the size of a decimal number. Given a fi xed word size,
binary and hexadecimal (see Figure 2.4) bit strings can encode the sign; hence we do
1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1000two
1) 4ten
2) 8ten
3) 16ten
4) 18,446,744,073,709,551,609ten
Elaboration: Twos complement gets its name from the rule that the unsigned sum
of an n-bit number and its n-bit negative is 2n; hence, the negation or complement of a
each bit, from 0 to 1 and from 1 to 0, or x. This relation helps explain its name since
than sign and magnitude, and several early scientifi c computers did use the notation.
This representation is similar to twos complement except that it also has two 0s:
A fi nal notation, which we will look at when we discuss fl oating point in Chapter 3,
is to represent the most negative value by 00 . . . 000two and the most positive value
by 11 . . . 11two, with 0 typically having the value 10 . . . 00two. This is called a biased
notation, since it biases the number such that the number plus the bias has a nonnegative
representation.
Check
Yourself
ones complement
01 . . . 11two, leaving an
1 and 1 to 0.
biased notation
A notation that represents
representation.