0% found this document useful (0 votes)
2 views

lec4

Computer numbers system

Uploaded by

nawa.star2001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

lec4

Computer numbers system

Uploaded by

nawa.star2001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lecture 4

Number Systems, Base Conversions,


and Computer Data Representation

Numbers can be classified according to how they are represented or according to the
properties that they have.

➢ Decimal - d
Decimal numbers use a positional notation system. Each digit is multiplied by an appropriate
power of 10 depending on its position in the number.

Decimal number uses 10 possible values (0 to 9) to form whole numbers.

843 = 8 x 102 + 4 x 101 + 3 x 100 = 8 x 100 + 4 x 10 + 3 x 1 = 800 + 40 + 3


In a positional notation system, the number base of 10 are used for Decimal numbers

Example: 84310 12710

➢ Octal - O
The octal numeral system (Oct) is the base-8 number system, and uses the digits 0 to 7.

In the octal system each place is a power of eight.

1128 = 1 x 82 + 1 x 81 + 2 x 80
➢ Hexadecimal - h

Also known as just hex, is base 16 number system, and uses the digits from 0 to 9 & wit 5
characters (A,B,C,D,E,F).

Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Example: 1116 3416 A12F16


➢ Binary

The binary number system is also a positional notation numbering system; the base is 2, its
only use two digit 0 and 1

Example: 1011012 112 101102


Each binary digit is multiplied by an appropriate power of 2 based on the position in the
number. The position of each digit is as follow
1011012
position … 8 7 6 5 4 3 2 1 0
8 7 6 5 4 3 2 1
Base 2 2 2 2 2 2 2 2 2 20
value … 256 128 64 32 16 8 4 2 1

4.1 To Convert Binary back to decimal, use above table

1011012 = 1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
= 1 x 32 + 0 x 16 + 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1
= 32 + 0 + 8 + 4 + 0 + 1
= 4510

.2 To convert Binary to Hex:


➢ Separate 4 digits from the right of number
➢ then convert each to dec ,
➢ convert each dec to hex using Hexadecimal table

111001012 = 1110 0101


1x8+1x4+1x2+0x1 0x8+1x4+0x2+1x1
14 5
Hex = E 5 = E516

.3 To convert Binary to Oct:


➢ Separate 3 digits from the right of number
➢ then convert each to dec

111001012 = 11 100 101


1x2+1x1 1x4+0x2+0x1 1x4+0x2+1x1
3 4 5
Oct = 3458
➢ Convert Decimal

5.1 To Binary system: decimal number can convert to binary system in different ways,
such as dividing decimal number to binary base of 2.
Decimal Binary Remain
Exp: convert 1810 to Binary
Number base value
18 2 0
step 1: divide the number by 2 ( binary base)
9 2 1
step 2: write the remain in 3rd column
4 2 0
step 3: write the result under the number
2 2 0
step 4: repeat above steps for the result of division till the result 1 2 1
less than base
step 5: rewrite remain value down to up
The result is 100102

.2 To Hex number
Decimal Hex Remain
Using Division by 16 as in 5.1 steps Number base value
Or 18 16 2
Step1: convert decimal to binary using above steps 1 16 1
Step2: convert the result from step1 to hex using Binary to Hex 4.2
The result is 1216

.3 To Oct System
Decimal Oct Remain
Using Division by 16 as in 5.1 steps
Number base value
18 8 2
2 8 2

➢ Hex Conversion The result is 228


6.1 To Decimal: converting hex number to decimal by multiply each digit by hex base power to its index
Exp: convert 3416 = 3 x 161 + 4 x 160 = 3 x 16 + 4 = 5210

.2 To Binary :
346A16
Step 1: convert each digit of hex to Decimal number separately 3 4 6 10
Step2: convert each decimal to four bits binary number separately 0011 0100 0110 1010
Step3: combine all binary result together 0011010001101010

.3 To Oct :
Step 1: convert the hex number to Decimal number
Step2: convert Decimal to Oct as in 5.3

You might also like