34
Spring 2017 / 2018 1 Numbering systems The decimal numbering system is widely used, because the people Accustomed( عتادا) to use the hand fingers in their counting. But with the development of the computer science another numbering systems are founded. Such as: Binary, Octal, Hexadecimal, or any base r > 2. Numbering systems classification Positional numbering systems: that depends on the position of the digit in the number. Which means that the same digit can take different values according to his position [decimal, Binary, Octal, Hexadecimal] None positional numbering systems: that dont use digit waits in the numbers. [ROMAN numbering system]

Numbering systemslms.uop.edu.jo/moodle/pluginfile.php/5680/mod_resource/content/0... · (0.828125)10 =(0.110101)2 ... • Example: Convert the following decimal number into octal

  • Upload
    others

  • View
    42

  • Download
    0

Embed Size (px)

Citation preview

Spring 2017 / 20181

Numbering systems

• The decimal numbering system is widely used, because the people Accustomed(اعتاد) to use the hand fingers in their counting.

• But with the development of the computer science another numbering systems are founded. Such as:– Binary, Octal, Hexadecimal, or any base r > 2.

• Numbering systems classification– Positional numbering systems: that depends on the position of

the digit in the number. Which means that the same digit can take different values according to his position [decimal, Binary, Octal, Hexadecimal]

– None positional numbering systems: that don’t use digit waits in the numbers. [ROMAN numbering system]

Spring 2017 / 20182

Numbering Systems Radix

• The base or the radix of any numbering system is equal to the number of symbols that used to represent its numbers

• The decimal number system is said to be of Base (Radix), 10 because it uses 10 digits

[ 0,1,2,…….,9]

• The Binary number system is said to be of Base (Radix), 2 because it uses 2 digits [ 1,0 ]

• The Octal number system is said to be of Base (Radix), 8 because it uses 8 digits [0,1,2,3….,7]

• The Hexadecimal number system is said to be of Base (Radix), 16 because it uses 16 digits [0,1,2,3…..,A,B,C,D,E,F]

Spring 2017 / 20183

decimal numbers

– The decimal number representation

X= (djdj-1….d3d2d1d0.d-1d-2d-3,…d-(k-1)d-k)10, where

dj (digit): 0,1,2….9 ,

j ( position): …3,2,1,0 ,-1,-2,-3…..

– X as a decimal number with j digits can be represented as

X=10j*dj+10j-1*dj-1….+102*d2+101*d1+100*d0+10-1*d-1+10-2*d-2+….10-(k-1)*d-(k-

1)+10-k*d-k

– the integer part of the number is represented by an ascending positive power

– The fraction part of the number is represented by an ascending negative power

Spring 2017 / 20184

Spring 2017 / 20185

Positional representation rule for numbers

• All positional numbering systems are the same in that they are depends on the wait of the digits in the number, and different only in the base.

• So we can use the same method of representing decimal numbers to be accepted by any other numbering system. As follows:

N=

• Where : R- base of the system,

• ai- the digits of the number,

• m- the number of the fraction digits,

• n- number of the integer digits - 1

i=-m

i=n

ai*Ri

Spring 2017 / 20186

Binary system

• Is of base 2 and has two digits (0,1)

• It is the system that used by the computer

• It is represented in the electronic circuits as two states:

on – 1

off – 0

Spring 2017 / 20187

Binary representation

• Using the previous rule we can represent

any binary number as

x=….b2*22+b1*2

1+b0*20+b-1*2

-1+b-2*2-2…..

Where: bi=0,1

Spring 2017 / 20188

Spring 2017 / 20189

Octal system

• The base of this system is 8.

• Its symbols are (0,1,2….7)• Using the previous rule we can represent any octal

number as

x=….o2*82+o1*8

1+o0*80+o-1*8

-1+o-2*8-2…..

Where: oi=0,1,2,3,4,5,6,7

Spring 2017 / 201810

Spring 2017 / 201811

Hexadecimal system

• The base of this system is 16

• it has 16 digits(0,1,2….9,A,B,C,D,E,F)

• A=10,B=11,C=12,D=13,E=14,F=15• Using the previous rule we can represent any

hexadecimal number as

x=….H2*162+H1*161+H0*160+H-1*16-1+H-2*16-2…..

Where: Hi=0,1,2,3,…..9, A,B,C,D,E,F

Spring 2017 / 201812

Spring 2017 / 201813

Number base conversions

• Base R to decimal conversion• A number expressed in base R can be converted to its decimal equivalent

by using the Positional representation rule [ multiplying each coefficient

with the corresponding power of R and adding]

N=i=-m

i=n

ai*Ri

Spring 2017 / 201814

Number base conversions

• Binary to decimal

Spring 2017 / 201815

Number base conversions

• Octal To Decimal Conversion

• Examples:

• (312.1)8=3*82+1*81+2*80+1*8-1=(3X64)+(8)+(2)+(1/8)=(202.125)10

• (752)8=7*82+5*81+2*80=(7X64)+(5X8)+(2X1)=(490)10

Spring 2017 / 201816

Number base conversions

• Hexadecimal to Decimal Conversion

Spring 2017 / 201817

Number base conversions

• Decimal to base R conversion

• The conversions from decimal to any base R number system is more convenient if the number is separated into an integer part and a fraction part and the conversion of each part is done separately.

• Example

• (d3d2d1d0.d-1d-2d-3(10 ( )r

• (d3d2d1d0(10 ( )r

• (.d-1d-2d-3(10 ( )r

• Integer part divided by base R

• Fraction part multiplied by base R

Spring 2017 / 201818

From decimal to binary

• We use the remainder method as follows:a) Integer part

1. The integer part of the number is divided by 2

2. The reminder calculated

3. The quotient resulted from step 1 divided by 2

4. The reminder calculated

5. The previous steps are repeated until the

quotient becomes equal to 0

6. The required binary number is the collection of

reminders ordered from the last reminder to

the first one

Spring 2017 / 201819

From decimal to binary

b) fraction part

• Converting fraction part is done using the multiplication

instead of division as follows:

1. multiply the number by 2

2. Get the integer part from the result obtained from step 1

3. Multiply the fraction obtained in step1 by 2

4. Get the integer part from the result obtained from step 3

5. Repeat the above steps until we have the fraction part of the

multiplication equals to 0 or we reached the required precision

6. The required number is the collection of integer digits obtained

after each multiplication.

Spring 2017 / 201820

Examples

( )2

Spring 2017 / 201821

Examples

• Example : Convert the following decimal numbers to Binary numbers

• 1- (29)10 2-(53)10 3-(41)10

1: Division Remainder

29/2 1 LSB

14/2 0

7/2 1

3/2 1

1/2 1 MSB

0

(29)10 =(11101)2

2: (53)10 Division Remainder

53/2 1 LSB

26/2 0

13/2 1

6 /2 0

3 /2 1

1 /2 1 MSB

0

(53)10 =(110101)2

3 : (41)10

41/2 1 LSB

20/2 0

10/2 0

5 /2 1

2 /2 0

1 /2 1 MSB

0

(41)10 =(101001)2

Spring 2017 / 201822

Examples

• Convert the following decimal number to a

binary (0.78125)10

Spring 2017 / 201823

Examples

• Example: Convert the following decimal number into binary Number

• 1: (0.828125 )10

0.828125 x2 = 1+ 0.65625 1 MSB

0.65625 x 2 = 1+ 0.3125 1

0.3125 x 2 = 0+ 0.625 0

0.625 x 2 = 1+ 0.25 1

0.25 x 2 = 0+ 0.5 0

0.5 x 2 = 1+ 0 1 LSB

(0.828125)10 =(0.110101)2

• 2: (41. 625 )10 =(41)10 + (0.625 )10

from the above example (41)10 is represented by (101001)2 while

(0.625 )10 is

0.625 x 2 = 1+ 0.25 1 MSB

0.25 x 2 = 0+ 0.5 0

0.5 x 2 = 1+ 0 1 LSB

(0.625 )10 = (101)2

so (41. 625 )10 = (101001.101)2

Spring 2017 / 201824

Decimal to octal

• Example: Convert the following decimal number into

octal Number (153.6875)10

• (231.54)8

Spring 2017 / 201825

Decimal to hexadecimal

• Example: Convert the following decimal number into

hexadecimal Number (125.34375)10

Spring 2017 / 201826

Binary to octal or hexadecimal and vise

versa

• Each octal digit corresponds to 3 binary digits

• Base 8 = 23

• Each hexadecimal digit corresponds to 4 binary

digits

• Base 16=24

Spring 2017 / 201827

Binary to octal

• Group each 3 binary digits from the radix point

Spring 2017 / 201828

Binary to octal

Spring 2017 / 201829

Binary to hexadecimal

• Group each 4 binary digits from the radix point

Spring 2017 / 201830

Binary to hexadecimal

Spring 2017 / 201831

Octal or hexadecimal to binary

• Each octal digit is converted to 3 binary digits according

to the table

Spring 2017 / 201832

Octal or hexadecimal to binary

• Each hexadecimal digit is converted to 4 binary digits

according to the table

Spring 2017 / 201833

Examples

Spring 2017 / 201834

Examples