Number system:-writing system for expressing numbers i.e. it is a notation for representing numbers of a given set ,using digits or other symbols in a consistent manner. It will * Represent all set of numbers * Give every number a unique representation * Reflect the algebraic and arithmetic structure of numbers
It is of two types: * Non-positional * Positional
Non-positional: a number system where each number is represented with help of a unique symbol. This type of number system has limited number of symbols present to represent a number. The representation of a number is not affected by the position the symbol. Example of it is roman number system. In this type of number system we have following …show more content…
set of symbols to represent the number S={I,V,X,L,C,D,M}.(## I=1;V=5;X=10;L=50,C=100;D=500;M=1000)
Example of roman numbers and their values: * III->1+1+1=3 * IV->5-1=4 * XIX->10+(10-1)=19
Positional: this number system contains special symbols called as digits to represent the number. The position of a digit determines the value of a number. Each position has specified weight associated with it. Value of number is determined by multiplying each digit by a weight and then summing. The weight of each digit is a POWER of the BASE and is determined by position. The right most digit present in a number has weight 0 associated with it which increases by one when we move from right to left and get decremented by one when we move on the right hand side of the digit i.e in the decimal part of the number
Example: 12.75 Number | 1 | 2 | . | 7 | 5 | Weight | 1 | 0 | . | -1 | -2 |
Positinal is further classified into four number system:-
BASE is the number of different digits including zero in the number system. It is also referred as radix (r). The number system that we use has base/radix 10 it has ten different digits to represent a number i.e. 0-9. The larger the base, the more different digits are required
Every number system with base r has r different digits to represent a number.
The starting digit of every number system is always 0 and the last digit is always one less the base.
Decimal number system: this is the number system that we use in our day to day life. The base of this number system is 10; it contains ten different digits to represent the number i.e. 0,1,2,3,4,.5,6,7,8,9. In this number system each digit is multiplied by the power of 10 depending upon its position to obtain its value.
843 10=8*102+4*101+3*100 =8*100+4*10+3*1 =800+40+3 =84310
Binary number system: this is the number system in which the machine language is written or we can say that this is language which computer understands. The base of this number system is 2; it contains 2 digits to represent the number i.e. 0 and 1. In this number system each digit is multiplied by the power of 2 depending upon its position to obtain its value.
1010112=1*25+0*24+1*23+0*22+1*21+1*20
=1*32+0*16+1*8+0*4+1*2+1*1 =32+0+8+0+2+1 =4310
To make the binary numbers more readable, the digits are represented in group of 4.
Octal number system: The base of this number system is 8; it contains eight different digits to represent the number i.e. 0,1,2,3,4,.5,6,7. In this number system each digit is multiplied by the power of 8 depending upon its position to obtain its value.
1368 = 1 * 82 + 3 * 81 + 6 * 80 = 1 * 64 + 3 * 8 + 6 * 1 =64+32+6 =9410
Hexadecimal number system: The base of this number system is 16; it contains sixteen different digits/symbols to represent the number i.e. 0,1,2,3,4,.5,6,7,8,9,A,B,C,D,E,F. it is difficult to represent any number beyond the 10 and to solve this problem the use of alphabets starting from A till the numbers of numerals that we want to represent the different alphabets are used here A=10;B=11 and so on till 15 i.e. F=15 . In this number system each digit is multiplied by the power of 16 depending upon its position to obtain its value.
12316 = 1 * 162 + 2 * 161 + 3 * 160 = 1 * 256 + 2 * 16 + 3 * 1 = 256 + 32 + 3 =29110
Reason to use octal and hexadecimal number system is that they can represent any number in a shorter and simple because of the relationship between 2,8 and 16. Sixteen(24) and eight(23) both are powers of two. Four digits of binary number can be represented in two and one digits of octal and hexadecimal respectively.
Decimal Binary Octal Hexadecimal
0 00000 0 0
1 00001 1 1
2 00010 2 2
3 00011 3 3
4 00100 4 4
5 00101 5 5
6 00110 6 6
7 00111 7 7
8 01000 10 8
9 01001 11 9
10 01010 12 A
11 01011 13 B
12 01100 14 C
13 01101 15 D
14 01110 16 E
15 01111 17 F
16 10000 20 10
Conversion: We need to know how to convert a number in one system to the equivalent number in another system. Since the decimal system is more familiar than the other systems, we first show how to covert from any base to decimal. Then we show how to convert from decimal to any base. Finally, we show how we can easily convert from binary to hexadecimal or octal and vice versa.
Conversion among Bases
Binary
Hexadecimal
Octal
Decimal
To convert base r into decimal number: * Binary to decimal * Octal to decimal * Hexadecimal to binary
BINARY TO DECIMAL Method * Multiply each bit by 2n, where n is the “weight” of the bit * The weight is the position of the bit, starting from 0 on the right * Add the results
101011.112 => 1 x 20 = 1 +1 x 21 = 2 +0 x 22 = 0 +1 x 23 = 8 +0 x 24 = 0 +1 x 25 = 32 +1x2-1= 0.5 +1x2-2= 0.25 = 43.7510
OCTAL TO DECIMAL Method * Multiply each bit by 8n, where n is the “weight” of the bit * The weight is the position of the bit, starting from 0 on the right * Add the results
7248 => 4 x 80 = 4 +2 x 81 = 16 +7 x 82 = 448 =46810
HEXADECIMAL TO DECIMAL Method * Multiply each bit by 16n, where n is the “weight” of the bit * The weight is the position of the bit, starting from 0 on the right * Add the results
ABC16 => C x 160 = 12 x 1 = 12 + B x 161 = 11 x 16 = 176 +A x 162 = 10 x 256 = 2560 = 274810
## To convert any number with base r into decimal multiply each digit of number with rn, where n is weight of the digit and then add the results.
To convert decimal number into base r number * Decimal to binary * Decimal to octal * Decimal to hexadecimal
DECIMAL TO BINARY Method * Divide by two, keep track of the remainder * Divide until quotient is zero * Record the remainder from bottom to up
12510= 2 125 2 64 1 2 32 0 bottom to up 2 16 0 2 8 0 100000012 2 4 0 2 2 0 2 1 0 0 1
To convert the fractional part into binary Method * Take the fractional part and multiply it with 2 * Record the decimal number * Multiply fractional part until it becomes equal to zero. * Then record the decimal part from top to bottom
125.0510= 2x0.05=0.10 0 2x0.10=0.20 0 2x0.20=0.40 0 top to bottom 2x0.40=0.80 0 2x0.80=1.60 1 =10000001.00001102 2x0.60=1.20 1 2x0.20=0.40 0
DECIMAL TO BINARY Method * Divide by eight , keep track of the remainder * Divide until quotient is zero * record the remainder from bottom to up
12510= 8 125 8 15 5 1758 8 1 7 8 0 1
To convert the fractional part into octal Method * Take the fractional part and multiply it with 8 * Record the decimal number * Multiply fractional part until it becomes equal to zero. * Then record the decimal part from top to bottom
125.0510= 8x0.05=0.40 0 8x0.40=3.20 3 8x0.20=1.60 1 =175.031468 8x0.60=4.80 4 8x0.80=6.40 6
DECIMAL TO HEXADECIMAL Method * Divide by sixteen, keep track of the remainder * Divide until quotient is zero * record the remainder from bottom to up
123410= 16 1234 16 77 2 =4D216 16 4 13 0 4
To convert the fractional part into hexadecimal Method * Take the fractional part and multiply it with 16 * Record the decimal number * Multiply fractional part until it becomes equal to zero. * Then record the decimal part from top to bottom
1234.0510= 16x0.05=0.80 0 16x0.80=1.28 1 =4D2.014716 16x0.28=4.48 4 16x0.48=7.68 7
##to convert the decimal number into another number system with base r we divide the number with base r until the quotient is zero and then record
To Convert Base X into Base Y * Binary to octal * Binary to hexadecimal * Octal to binary * Octal to hexadecimal * Hexadecimal to binary * Hexadecimal to octal
General method:- To convert number in a base X into base y 1. Convert the number in base X into decimal by multiplying each digit of a number with X raise to the power of weight of digit. 2. Convert the number obtained in decimal into base Y by dividing the number by Y until the quotient is zero.
BINARY TO OCTAL Method 1. Convert the number in binary into decimal by multiplying each digit of a number with 2 raise to the power of weight of digit. 2. Convert the number obtained in decimal into octal by dividing the number by 8 until the quotient is zero.
Shortcut Method 1. Group bits in threes, starting on right 2. Convert to octal digits, multiplying each digit by 2 of each group 3. In case of digits after the decimal group bits in threes, starting from left.
1011010111.101102 = ?8 1 011 010 111 . 101 100
1 3 2 7 . 5 4 1011010111.101102 = 1327.548
BINARY TO HEXADECIMAL Method 1. Convert the number in binary into decimal by multiplying each digit of a number with 2 raise to the power of weight of digit. 2. Convert the number obtained in decimal into hexadecimal by dividing the number by 16until the quotient is zero.
Shortcut Method 1. Group bits in fours, starting on right 2. Convert to hexadecimal digits, multiplying each digit by 2 of each group 3. In case of digits after the decimal group bits in fours, starting from left.
1010111011.10112 = ?16 10 1011 1011 . 1011 2 B B B 1010111011.10112 = 2BB.B16
OCTAL TO BINARY Method 1. Convert the number in octal into decimal by multiplying each digit of a number with 8 raise to the power of weight of digit. 2. Convert the number obtained in decimal into binary dividing the number by 2 until the quotient is zero.
Shortcut method 1. Convert each octal digit to a 3-bit equivalent binary representation dividing by 2.
7058 = ?2 7 0 5
111 000 101 7058 = 1110001012
OCTAL TO HEXADECIMAL Method 1. Convert the number in octal into decimal by multiplying each digit of a number with 8 raise to the power of weight of digit. 2. Convert the number obtained in decimal into binary dividing the number by 2 until the quotient is zero.
Shortcut method 1. Convert each octal digit to a 3-bit equivalent binary representation dividing by 2. 2. Convert the binary number to hexadecimal by grouping bits in fours, starting from right.
10768 =?16 1 0 7 6
001 000 111 110 10768=0010001111102
0010 0011 1110 2 3 E 10768=23E16
HEXADECIMAL TO BINARY Method 1.
Convert the number in hexadecimal into decimal by multiplying each digit of a number with 16 raise to the power of weight of digit. 2. Convert the number obtained in decimal into binary dividing the number by 2 until the quotient is zero.
Shortcut method 1. Convert each octal digit to a 4-bit equivalent binary representation dividing by 2.
10AF16 = ?2 1 0 A F
0001 0000 1010 1111 10AF16 = 00010000101011112
HEXADECIMAL TO OCTAL Method 1. Convert the number in hexadecimal into decimal by multiplying each digit of a number with 16 raise to the power of weight of digit. 2. Convert the number obtained in decimal into binary dividing the number by 8 until the quotient is zero.
Shortcut method 1. Convert each octal digit to a 4-bit equivalent binary representation dividing by 2. 2. Convert the binary number to hexadecimal by grouping bits in threes, starting from right.
1F0C16 =?8 1 F 0 C
0001 1111 0000 1100 1F0C16=00011111000011002
0 001 111 100 001
100
0 1 7 4 1 4 1F0C16 = 174148
BASIC ARITHMETIC BINARY ARITHMETIC * Addition * Subtraction * Multiplication * Division
ADDITION
0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 (plus carry 1)
Add 101 AND 10 1 0 1
+ 1 0
= 1 1 1
SUBTRACTION 0 - 0 = 0 0 - 1 = 1(with a borrow) 1 - 0 = 1 1 - 1 = 0
Subtract 101 AND 10 1 0 1 - 1 0
= 0 1 1
MULTIPLICATION
0 * 0 = 0 0 * 1 = 0 1 * 0 = 0 1 * 1 = 1
Multiply 101 AND 10 1 0 1
X 1 0 0 0 0 1 0 1 X 1 0 1 0 Division 0 / 1 = 0 1 / 1 = 1
Octal arithmetic * Addition * Subtraction
ADDITION * Add the numbers as the decimal addition is performed , if after addition the sum is greater than 7 then add 2 to it to get the final sum in octal number * Convert the number into its binary equivalent and then add the two numbers and convert the sum obtain into its octal equivalent by the given method
Add 258 and 47 2 5 + 4 7 12 + 2 14 7 4
Subtraction * Same procedure is applied to subtract octal number as decimal and when subtraction with the help of borrow then 2 is subtracted from the result to get the octal equivalent * Convert the number into its binary equivalent and then subtract the two numbers and convert the sum obtain into its octal equivalent by the given method
Sub 258 from 718 7 1 2 5 6 - 2 4 4
Hexadecimal arithmetic * Addition * Subtraction
ADDITION * Add the numbers as the decimal addition is performed , if after addition the sum is greater than 15 then subtract 6 from it to get the final sum in hexadecimal number * Convert the number into its binary equivalent and then add the two numbers and convert the sum obtain into its hexadecimal equivalent by the given method
Add 37 and 49 3 7 4 9
16
6
10
6 0
Subtraction * Same procedure is applied to subtract octal number as decimal and when subtraction with the help of borrow then 6 is added to the result to get the hexadecimal equivalent * Convert the number into its binary equivalent and then subtract the two numbers and convert the sum obtain into its hexadecimal equivalent by the given method
Sub 35 from A4 A 4 3 5 9 + 6 15 6 F
Complements The complement of a number is a number which when added to the original will make it equal to a multiple of the base of the number system e.g. 60 is a complement of 40, as 60+40=100 and 100 is a multiple of 10. * R’s complement(radix complement) * (r-1)’s complement (diminished radix complement)
R’s complement (radix complement) For any positive number N it is defined as (rn)-N, where r is the base of the number system and n is the number of digits in integer part of N
Find 10’s complement of (5432)10 r=10 n=4 N=5432 = (104)-(5432) =10000-5432 =4568
(R-1)’s complement (diminished radix complement) For any positive number N it is defined as (rn)-(rm)-N, where r is the base of the number system , n is the number of digits in integer part of N and m is the number of digits after decimal.
If no digits are dere after decimal then rn-1-N
Find 9’s complement of (5432)10 r=10 n=4 N=5432 = (104)-1- (5432) =10000-1-5432 =4567