Chapter 2: Binary Numbers - Philadelphia

21-04-2014

Philadelphia University Faculty of Information Technology Department of Computer Science

Computer Logic Design

By Dareen Hamoudeh

Dareen Hamoudeh

1

Chapter 2: Binary Numbers

Dareen Hamoudeh

2

1

21-04-2014

Unsigned Binary Numbers

Dareen Hamoudeh

3

Complements

? Complements are used in digital computers for simplifying the subtraction operations and for logical manipulation.

? There are two types of complements for each base-r system.

? The r's complement.

? The (r-1)'s complement.

? When the value of the base is substituted, the two types receives the names:

? For binary numbers: 2's and 1's complement.

? For decimal numbers: 10's and 9's complement.

Dareen Hamoudeh

4

2

21-04-2014

The r's Complement

Dareen Hamoudeh

5

r's Complement For Decimal Numbers:

? Given a positive number N in base r with an integer part of n digits, the r's complement of N is defined as (rn-N) for N 0 and 0 for N=0.

? Example: Find the r's complement for the following:

(in other word: find the 10's complement) ? (52520)10 = 105-52520 =47480

The number of digits in the number is n=5 ? (0.3267)10 = 1- 0.3267 = 0.6733

No integer part so 10n=100=1 ? (25.639)10 = 102-25.639=74.361

Dareen Hamoudeh

6

3

r's Complement For Decimal Numbers

? Another way:

21-04-2014

Example: Find the 10's complement for the following:

will be (12398)10

Subtracted From 9 9 9 9 10

(246700)10

will be

Subtracted

from 9 9 9 10

Zeros, so Leave them

= 8 7 6 0 2

=7 5 3 3 0 0

Dareen Hamoudeh

7

r's Complement For Binary Numbers

? Given a positive number N in base r with an integer part of n digits, the r's complement of N is defined as (rn-N).

? Example: Find the r's complement for the following: (in other word: find the 2's complement)

? (101100)2 = (26)10 ? (101100)2=(1000000 - 101100)=010100 ? (0.0110)2 = (1-0.0110)2=0.1010

Dareen Hamoudeh

8

4

21-04-2014

r's Complement For Binary Numbers

? Another way:

? Example: Find the 2's complement for following:

(101100)2

will be

Zeros, so

replaced

Leave them

First Non-Zero,

= 0 1 0 1 0 0 So leave it

(0110111)2

will be replaced

First Non-Zero, So leave it

= 1 0 0 1 0 0 1

Dareen Hamoudeh

9

The (r-1)'s Complement

Dareen Hamoudeh

10

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download