You are on page 1of 3

Summary

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.

Elaboration: For signed decimal numbers, we used to represent negative

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

not normally use or with binary or hexadecimal notation.

What is the decimal value of this 64-bit twos complement number?

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

number x is 2n x, or its twos complement.

A third alternative representation to twos complement and sign and magnitude is

called ones complement. The negative of a ones complement is found by inverting

each bit, from 0 to 1 and from 1 to 0, or x. This relation helps explain its name since

the complement of x is 2n x 1. It was also an attempt to be a better solution

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:

00 . . . 00two is positive 0 and 11 . . . 11two is negative 0. The most negative number,

10 . . . 000two, represents 2,147,483,647ten, and so the positives and negatives are


balanced. Ones complement adders did need an extra step to subtract a number, and

hence twos complement dominates today.

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

A notation that represents

the most negative value

by 10 . . . 000two and the

most positive value by

01 . . . 11two, leaving an

equal number of negatives

and positives but ending

up with two zeros, one

positive (00 . . . 00two) and

one negative (11 . . . 11two).

Th e term is also used to

mean the inversion of

every bit in a pattern: 0 to

1 and 1 to 0.

biased notation
A notation that represents

the most negative value

by 00 . . . 000two and the

most positive value by 11

. . . 11two, with 0 typically

having the value 10 . . .

00two, thereby biasing

the number such that

the number plus the

bias has a non-negative

representation.

2.4 Signed and Unsigned Numbers 79

80 Chapter 2 Instructions: Language

You might also like