02 Number Systems
02 Number Systems
02 Number Systems
simultaneously. i.e. they are mutually exclusive. In computer terminology, 1 means on and 0 means off.
No. of
Different
Bits
Combinations
21 = 2
22 = 4
22-1 = 3
23 = 8
23-1 = 7
different numbers, alphabets or special symbols. So we require a series of bits. 8 bits together makes one byte. With one byte, we can store 256 different combinations, which include digits, alphabets and special symbols.
Relationship 8 BITS = 1 byte 4 BITS = 1 Nibble 1 Bytes = 2 Nibbles 1024 Bytes = 1 Kilo Byte (KB) 1024 KB = 1 Mega Byte (MB) 1024 MB = 1 Giga Byte (GB) 1024 GB = 1 Tera Byte (TB) Q.1. Why 1024 Bytes make 1 Kilo byte? Q.2. What would be the highest number that we can store, if we are having 9 bits?
Radix or Base
Digits
(153.25)10
10 09
Radix or Base
2 Digits 0&1 Conversion To Decimal (101.11)2 = (1 * 22) + (0 * 21) + (1 * 20) + (1 * 2-1) + ( 1 * 2-2) = (4 + 0 + 1 + .5 + .25 ) = (5.75)10
8 (23 ) Digits 07 Conversion To Decimal (250.14)8 = (2 * 82) + (5 * 81) + (0 * 80) + (1 * 8-1) + ( 4 * 8-2)
Radix or Base
(AB.75)16 =(A*161)+(B*160)+(7*16-1)
+(5*16-2)
= (10*16)+(11*1)+(7/16)+(5/256) = (171.45703125)10
(35.25)10 = (?)2 (for integer part) Keep on dividing 35 by 2 & then take remainder
from bottom to top. (For fractional part) Keep on multiplying .25 by 2 unless you get .00. Take digits from top to bottom.
(35.25)10 = (?)2
.25
2 2 2 2 2 2
35 17 8 4 2 1 1 1
--------
0
0 0 0
.50
* 2
--------1 .00
2 2 2
35 17 8 1 1
.25
2
2
4
2
0
0
--------
0
*
.50
2
1
0
0
1
--------1 .00
(35.25)10 = (100011.01)2
Two Ways
Convert Binary To Decimal; And Decimal To Octal
Or
Use Direct Conversion
111
Two Ways
Convert Binary To Decimal; And Decimal To Hexa Decimal
Or
Use Direct Conversion
Right to Left. i.e. 0001 0111 1111 Compare them with 8421
8 0 0 1 4 0 1 1 2 0 1 1 1 1 1 1
=1 =7 = 15 i.e. F
. . . ( 1 7 F ) 16
(1110101)2
(AC0E)16 (007)8 (182.75)10
= ( ? )8
= ( ? )8 = ( ? )2 = ( ? )2
( ? )10
( ? )10 ( ? )10 ( ? )16
( ? )16
( ? )2 ( ? )16 ( ? )8
American Standard Code For Information Interchange Most Widely Used Coding System To Represent Data.
while ASCII-8 uses all bits. Diff. combinations includes 10 digits ( 0 - 9 ) (ASCII values 48-57) 26 upper case alphabets (A Z) (ASCII values 65-90) 26 lower case alphabets (a-z) (ASCII values 97-122)
Diff.Combinations includes 10 digits + 52 alphabets Remaining are special characters and graphics
characters. To store a single character, we require one byte. Example: To store 153, we require 3 bytes. 1 = 49 = 00110001 5 = 53 = 00110101 3 = 51 = 00110011 = (00110001 00110101 00110011)ASCII
character set from different languages. Character set includes Latin, Greek, Arabic, Cyrillic, Hebrew, Katakana, Hangul, Hindi besides including characters from English, German, Spanish & French.
system to represent data. 1st 256 combinations are same as that of ASCII.
about alphabets? So, a new method of BCD was developed. 2 zone bits were added to 4 bits combination
00 0000
Zone bits
digit bits
Includes 10 Digits 26 Upper Case Characters 26 Lower Case Characters Rest Printable And Non-printable Control Characters and Special Symbols.
on i.e. 1111
To store 153, we require 3 bytes as under: 1 = 1111 0001 5 = 1111 0101 3 = 1111 0011 = (11110001 11110101 11110011) EBCDIC
integer values inside the computer. It can store signed as well as unsigned numbers. The signs of all bits except the left most bit are +ve and the sign of leftmost bit is ve.
Suppose we have only 2 bits and we want to store ve numbers also, we will have to take one bit for storing sign. 0 means number is +ve and 1 means number -ve.
Sign bit
Digit Bit
Suppose we have only 3 bits and we want to store ve numbers also, we will have to take one bit for storing sign. 0 means number is +ve and 1 means number -ve.
Sign bit
Digit Bit Digit bit
-4 to +3 With 4 BITS : -8 to +7 With 8 BITS : -128 to +127 With 16 BITS : -32768 to +32767 Here, only left most bit will have ve weight.
8 bits)
107 -107
Convert following 2s complement numbers into
10001101 01111111
Therefore, 1 + 1 + 1 = 1 with carry 1 TRY THESE: 10001001 10110 11 +1 0 0 1 1 0 1 1 +1110001 100100100 110011 00
OR
NOT
0 1
B
0 1
B
0 1 1 0
0 0 0
0 0 1 1 1 1
1 0 1
OR
AND
NOT
AND
A B
AND
Binary multiplication
A B
5 11 55
Manual verification: 32 + 16 + 4 + 2 + 1 = 55 Implemented in hardware using multiple shift-left and add steps
(10101)2 (1010) 2 = ( ? ) 2
1 0 1 0 1 ---->
0 1 0 1 0
Numbers having an Integer part and a Fractional part, is called a Real Number or Floating-Point Number. It can be either +ve or ve. Every number can be represented in a Scientific Form i.e. N = m r e N=no, m=mantissa, r=radix, e=exponent
using 10 bits mantissa & 6 bits for exponent, binary +1010.001 can be represented as
sign mantissa sign exponent
101000100
00100
IEEE 754 Floating Point Standards Special codes for +/- infinity, NaN,
31 sign
(118.625)10 = ( ? )32-BITS IEEE FORMAT First we need to get the sign, the exponent and
the fraction. The sign will be "1" as the whole number is a negative number. Now, we write the number (without the sign; i.e. unsigned, no two's complement) using binary notation. The result is 1 1 1 0 1 1 0 . 1 0 1.
A normalized floating point number. Next, let's move the radix point left, leaving only
a 1 at its left: 1 1 1 0 1 1 0 . 1 0 1 = 1 . 1 1 0 1 1 0 1 0 1 26. The first 1 binary digit is dropped. The fraction is the part at the right of the radix point, filled with 0 on the right until we get all 23 bits. i.e. 1 1 0 1 1 0 1 0 1 00000000000000.
binary and bias it (so the most negative exponent is 0, and all exponents are nonnegative binary numbers). For the 32-bit IEEE 754 format, the bias is 127 So 6 + 127 = 133. In binary, this is written as 10000101.
binary and bias it (so the most negative exponent is 0, and all exponents are nonnegative binary numbers). For the 32-bit IEEE 754 format, the bias is 127 So 6 + 127 = 133. In binary, this is written as 10000101.
31 1
30 23 10000101
22 0 11011010100000000000000
Double Precision (64 Bits) 1 Bit To Store Sign (Left Most Bit) Exponent Uses 11 Bits Biased Representation Biased Mean Adding 1023 To Exponent Exponent Ranges From -1022 To +1023 52 Bits For Mantissa
63 sign
accuracy. If we increase the exponent bits in 32-bit format, the range can be increased but accuracy of number goes down as size of mantissa will become smaller. Higher the no. of bits in mantissa, better will be precision.
complicated. Most ALU do only integer arithmetic Real (floating point) arithmetic is done
in software on some low-end processors. in a floating-point unit (FPU) on most modern
processors.
Most processors today support single and