NUMBER SYSTEM Objectives q Understand why computers use
NUMBER SYSTEM
Objectives q. Understand why computers use binary (Base-2) numbering. q. Understand how to convert Base-2 numbers to Base 10 or Base-8. q. Understand how to convert Base-8 numbers to Base 10 or Base 2. q. Understand how to convert Base-16 numbers to Base 10, Base 2 or Base-8. 2
Types Of Numbers • Natural Numbers – The number 0 and any number obtained by repeatedly adding a count of 1 to 0 • Negative Numbers – A value less than 0 • Integer – A natural number, the negative of a natural number, and 0. – So an integer number system is a system for ‘counting’ things in a simple systematic way Example = -5 -4 -3 -2 -1 0 1 2 3 4 5
• Number systems include decimal, binary, octal and hexadecimal • Each system have four number base Number System Base Symbol Binary Base 2 B Octal Base 8 O Decimal Base 10 D Hexadecimal Base 16 H 4
Why Binary System? • Computers are made of a series of switches • Each switch has two states: ON or OFF • Each state can be represented by a number – 1 for “ON” and 0 for “OFF” 5
Converting Base-2 to Base-10 (1 0 0 1 1) ON OFF ON ON 2 ON/OFF Exponent: 24 23 22 21 20 16 0 0 2 1 (19)10 Calculation: + + 6 + + =
1. 2 The Binary Number Base Systems • Most modern computer system using binary logic. The computer represents values(0, 1) using two voltage levels (usually 0 V for logic 0 and either +3. 3 V or +5 V for logic 1). • The Binary Number System uses base 2 includes only the digits 0 and 1 • The weighted values for each position are : Base 2^5 2^4 2^3 2^2 2^1 2^0 2^-1 2^-2 32 16 8 4 2 1 0. 5 0. 25 7
Binary Numbering System • How is a positive integer represented in binary? • Let’s analyze the binary number 110: 110 = (1 x 22) + (1 x 21) + (0 x 20) = (1 x 4) + (1 x 2) + (0 x 1) Position weights 22 21 20 Number digits 1 1 0 0 x 20 = 1 x 21 = 1 x 22 = 0 + 2 + 4 6 n So a count of SIX is represented in binary as 110
1. 1 Decimal Number System • The Decimal Number System uses base 10. It includes the digits {0, 1, 2, …, 9}. The weighted values for each position are: Base 10^4 10^3 10^2 10000 100 10^1 10^0 10^-1 10^-2 10^-3 10 left of the decimal point 1 0. 01 0. 001 Right of decimal point 9
• Each digit appearing to the left of the decimal point represents a value between zero and nine times power of ten represented by its position in the number. • Digits appearing to the right of the decimal point represent a value between zero and nine times an increasing negative power of ten. • Example: the value 725. 194 is represented in expansion form as follows: • 7 * 10^2 + 2 * 10^1 + 5 * 10^0 + 1 * 10^-1 + 9 * 10^-2 + 4 * 10^-3 • =7 * 100 + 2 * 10 + 5 * 1 + 1 * 0. 1 + 9 * 0. 01 + 4 * 0. 001 • =700 + 20 + 5 + 0. 1 + 0. 09 + 0. 004 • =725. 194 10
Decimal Numbering System • How is a positive integer represented in decimal? • Let’s analyze the decimal number 375: 375 = (3 x 100) + (7 x 10) + (5 x 1) = (3 x 102) + (7 x 101) + (5 x 100) Position weights Number digits 102 101 100 3 7 5 5 x 100 = 5 + 7 x 101 = 70 + 3 x 102 = 300 375
• Example: convert the number 333 to binary. Division 333/2 166/2 83/2 41/2 20/2 Quotient 166 83 41 20 10 Remainder Binary 1 1 0 01 1 1101 0 01101 10/2 5/2 2/2 1/2 5 2 1 0 0 1 001101 1001101 01001101 12
OCTAL NUMBER SYSTEM • • Octal Number system base of 8 It has eight digit Numbers 0 1 2 3 4 5 6 & 7 Octal number value is 0 to 7 The octal Number system is also a positional number system. Each octal digit its own positional value or weight expressed as a power of 8
Octal Numbering System • Base: 8 • Digits: 0, 1, 2, 3, 4, 5, 6, 7 n Octal number: 3578 = (3 x 82 ) + (5 x 81) + (7 x 80) § To convert to base 10, beginning with the rightmost digit, multiply each nth digit by 8(n-1), and add all of the results together.
Hexadecimal Number System • It’s also called base 16 number system Since it consists number between 0 to 15. But we can represent 0 -9 only. Then, how to represent 10, 11, 12, 13, 14, 15. • In hexadecimal, we will use A to F for remaining 6 numbers i. e. 10 to 15. Like, Hexadecimal representation for 10 is A, 11 -B 12 -C, 13 -D, 14 -E, 15 -F.
Hexadecimal (Hex) Numbering System • Base: 16 • Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F n Hexadecimal number: 1 F 416 = (1 x 162 ) + (F x 161) + (4 x 160)
Binary (base 2) Octal (base 8) 0 1 10 11 100 111 1000 1001 1010 1011 1100 1101 1110 1111 10000 0 1 2 3 4 5 6 7 Hexadecimal (base 16) 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 Decimal (base 10) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
- Slides: 17