Number System 2010 [email protected]Page 1 Decimal Number System • It is a base 10 numbering system consisting of 10 numbers 0,1,2,3,4,5,6,7,8 and 9. • Also called Denary. • Represented as (123) 10 (here 10 is the radix of a decimal number system) Conversion: 1. Decimal to Binary Ex: (74) 10 = (?) 2 Radix Number Remainder 2 74 0(LSB) 2 37 1 2 18 0 2 9 1 2 4 0 2 2 0 1 1(MSB) (74) 10 = (1001010) 2 Ex: Fractional decimal to binary (0.625) 10 = (?) 2 0.625*2 = 1.25 0.25*2 = 0.5 0.5*2 = 1
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
• A number expressed in binary form i.e 0 and 1. It is represented by base 2. eg (10)2
• Computer use this number system for their internal processing. • 1 indicates high voltage and o indicates low voltage. • 1 is yes or on and 0 is no or off. • Invented by Francis Bacon in 1623 AD
Octal Number System • Octal means eight which came from Latin “octo”. • It is a base 8 number system consisting of eight digits 0,1,2,3,4,5,6 and 7. • The octal system is used in programming as a compact means of
representing binary numbers. • Represented as (23)8 Table for octal system
9’s Complement -is obtained by subtracting each digit’s from 9 Ex: 9’s Complement of 5 is 4 9’s Complement of 321is 678 10’s Complement
-10’s Complement of a decimal number is obtained by adding 1 to the 9’s Complement of a number
Ex: 9’s complement of 73 is 26 10’s Complement of 73 is 26+1 =27
Now, Number + 10’s Complement of a number is 0. 73 +27=100 (neglect 1) Now, 73 - 23 = 50 73 + (10’s complement of 23 i.e 77) =150(ignore 1 as we are doing for 2 bit only) Ex:
73-77 -> the result will be in 10’s complement form 73-77 = -4 73 + (10’s complement of 77 i.e 23) = 96 (96 = (99-04)+1) 96 is the 10’s complement of 4. So we can say that 10’s complement represents the negative number). The answer is -4
10’s Complement of 26 is 74 10’s Complement of 43 is 57 Add 74+57= 131 (neglect 1) 31= ((99-69) +1) is the 10’s complement of 69 So the answer is -69.
1’s Complement
-is obtained by subtracting each bit from 1. Eg: 1’s complement of 1010 is 0101
Subtraction of Binary Number using 1’s Complement Method Steps:
1. Make the both numbers having same number of bits 2. Determine the 1’s complement of the number to be subtracted
(subtrahend). 3. Add the 1’s complement to the given number from which we subtract
(minuend). 4. If there exists any additional bit (carry) in the result after addition,
remove and add it to the result else (i.e if there exits no any carry) determine the 1’s complement of the result and prefix by negative sign to the final result.
Example:
a. Subtract 100110 from 110001
1’s complement of 100110 is 011001 Add it with minuend (110001) 110001 1001010 So there exits a carry bit so add it 001010 +1 001011 So the difference is 1011
b. Subtract 110001 from 100110 1’s complement of 110001 is 001110
Add it with minuend (100110) 100110 110100 Since there exists no carry bit so the result is the 1’s complement of 110100 Hence the difference is -1011
2’s Complement 2’s complement is obtained by adding 1 to 1’s complement of binary digits. Subtraction using 2’s Complement Steps:
1. Make the both numbers having same number of bits 2. Determine the 2’s complement of the number to be subtracted
(subtrahend). 3. Add the 2’s complement to the given number from which we subtract
(minuend). 4. If there exists any additional bit (carry) in the result after addition,
neglect the carry bit and remaining is the result else (i.e if there exits no any carry) determine the 2’s complement of the result and prefix by negative sign to the final result.
Example:
a. Subtract 100110 from 110001 b. Subtract 110001 from 100110
Signed and Unsigned Number Representation
- In computer we cannot put – or + sign before integer - 0 is placed before a binary number to represent positive
- 1 is placed before a binary number to represent a negative number
So, 9 -> 0 1001 -9-> 1 1001
Negative number can be represented by following ways
i. Signed Magnitude 1 1001 ii. Signed 1’s Complement method 1 0110 iii. Signed 2’s Complement method 1 0111
8 bit representation 7 bit is used to represent the number and 1 bit is used to represent the sign -9 can be represented as Signed- magnitude 1 0001001 1’s Complement method 1 1110110 2’s Complement method 1 1110111 Fixed Point Representation of a Number A number which has both an integer part and a fractional part is called a real number or a floating point number. Fixed Point Representation automatically keeps track of the position if the binary or decimal point. Real No Scientific Notation 123.23 1.2323 x 102 0.008 0.8 x 10-2
N= mre Where m= mantissa r = radix of the number system e = exponent 123.23 sign 0 sign 0 Mantissa .12323 exponent 03 -123.23 sign 0 sign 0
Binary Coded Decimal BCD is the representation which uses 4 bits to represent a decimal
number. Ex: 2 -> 0010
21-> 0010 0001
Disadvantage: difficult to form a complements when numbers are represented in BCD Solution: to overcome this Excess-3 code is used Gray Code: Gray Code is a binary code used in shaft encoder which indicates the angular position of a shaft in digital form. The binary bits are arranged in such a way that only one binary bit changes at a time when we make a change from any numbers to the next. So, largest possible error will be one least significant digits. Used in computer controlled lathes.( Machine tool for shaping metal or wood)
Eg: 7 -> 8 (7 to 8) Gray Code -> 0100 -> 1100 In binary ->0111 -> 1000 If u miss one in binary u miss every thing but in gray code if u miss 1 then it will be 7 .( miss indicated not detected by sensors.)
- First 3 bit zone bits - Remaining 4 digit values
Character ASCII EBCDIC
0 0011 0000 1111 0000
1 0011 0001 1111 0001
2 0011 0010 1111 0010
9 0011 1001 1111 1001
A 0100 0001 1100 0001
B 0100 0010 1100 0010
H 0100 1000 1100 1000
P 0101 0000 1101 0111
Bits, Bytes and Words Bits -> 0,1 Bytes -> 8 bits -Storage location using EBCDIC or ASCII-8 codes representing 8 bits can hold one character A 32 bit world length computer might have registers with a capacity 32 bits and transfer data and instructions within the CPU with a group of 32 bits.