Number System
Number System
Computer circuits are electronic circuits and are two-state
circuits, OFF and ON state.
In decimal system weights are fixed and position dependent
e.g. 1) 543
3 x 100 = 3
4 x 101= 40
5 x 102= 500
Number System
2) 4 0 7 . 1 5
102 101 100 10-1 10-2
Position of digit is contributing to its value.
Weights of position has got fixed value.
Number System
In binary system different positions have free values. Position
values are in powers of two’s.
e.g.
1 0 1 0 1
24 23 22 21 20
1 1 1 0.1 1
23 22 21 20 2-1 2-2
Number System
Convert the following into binary system.
(26)10
(0.75)10
(0.6)10
Number System
Add 1011 and 1110
Subtract 0111 from 1001
Subtract 1011 from 1100
Number System
Multiply 101 and 011
Divide 11001 by 101
Number System
In octal system base is 8 and eight different symbols are used i.e. 0, 1, 2, 3, 4, 5, 6,
7.
In hexadecimal system base is 16 and symbols used are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C, D, E, F.
Problems:
Convert (561)10 to octal number.
Convert (566)10 and (4651)10 to hexadecimal.
Convert (122B)16 to decimal.
Convert (236)16 to decimal.
Convert (1061)8 to decimal.
Convert (72.6)10 to octal and hexadecimal numbers.
Number System
Binary to octal
(11010.1011)2
011010.101100
3 2 . 5 4
i.e. (32.54)8
Number System
Octal to binary
(2 0 7)8
(010000111)2
( 6 1 5 . 7 2 )8
(110001101.111010)2
Number System
Hexadecimal to binary
( 6 A 5)16
(011010100101)2
(1 0 0 . A 2 )16
(000100000000.10100010)2
Number System
Binary to hexadecimal
(1011001.10111)2
01011001.10111000
5 9 . B 8
(59.B8)16
Number System
8-bit Representation:
1) +47 – 47 = 0
00101111 + 11010001 = 00000000
IEEE 754 standards of Floating Point numbers
IEEE Standard 754 floating point is the most common representation today
for real numbers on computers, including Intel-based PC’s, Macs, and most
Unix platforms.
IEEE 754 standards of Floating Point numbers
IEEE 754 has 3 basic components:
1)The Sign of Mantissa – This is as simple as the name. 0 represents a
positive number while 1 represents a negative number.
2)The Biased exponent – The exponent field needs to represent both positive
and negative exponents. A bias is added to the actual exponent in order to
get the stored exponent.
3)The Normalised Mantissa – The mantissa is part of a number in scientific
notation or a floating-point number, consisting of its significant digits. Here we
have only 2 digits, i.e. 0 and 1. So a normalised mantissa is one with only
one 1 to the left of the decimal point.
Normalized floating point number is in 1.Mantissa format.
IEEE 754 standards of Floating Point numbers
IEEE 754 numbers are divided into two based on the three
components- sign, normalized mantissa and Biased exponent.
1) Single precision: Real numbers 4 bytes representation i.e.
32 bits.
2) Double precision: Real numbers 8 bytes representation i.e.
64 bits.
0001 1100 0000 0000 0000 0000 0000 0000 0000 0000
1 100 0000 0011 0000 0000 0000
1) Find the sign bit by xor-ing sign bits of A and B [Sign bit = (0 xor 0) = 0]
Contd..
2) Multiply the mantissa values including the "hidden one". The Resultant
product of the 24 bits mantissas (M1 and M2) is 48bits (2 bits are to the left
of binary point)
If M3 (48) = "1" then left shift the binary point and add "1" to the exponent
else don't add anything. This normalizes the mantissa. Truncate the result to
24 bits. Add the exponent "1" to the final exponent value.
Contd..
3) Find exponent of the result. = E1 + E2 -bias + (normalized exponent
from step 2) = (10000101)2 + (10000010)2 - bias +1
= 133 + 130 - 127 + 1 = 137
4) Final result:
X3 in decimal = 10.3125.
Contd..
8) If we had to perform subtraction, just change the sign bit of X2 to "1",
Then we would have subtracted the mantissas. Since sign bits are not
equal.
IEEE 754 standard floating point Division
Division of IEEE 754 Floating point numbers (X1 / X2) is done by dividing the
mantissas and subtracting the exponents.
X1=127.03125
X2=16.9375
Equivalent floating point binary words are
1) S3 = S1 xor S2 = 0
2) E3 = (E1 - E2) + bias = (10000101) - (10000011)+ (1111111)
= 133-131+127 => 129 => (10000001)
Contd..
3) Divide the mantissas M1/M2
4) Result
X3 in decimal = 7.5