SlideShare ist ein Scribd-Unternehmen logo
1 von 61
By: 
Ebooks.edhole.com
2.1 Decimal, Binary, Octal and Hexadecimal 
Numbers 
2.2 Relation between binary number system 
with other number system 
2.3 Representation of integer, character and 
floating point numbers in binary 
2.4 Binary Arithmetic 
2.5 Arithmetic Operations for One’s 
Complement, Two’s Complement, magnitude 
and sign and floating point number 
Ebooks.edhole.com
Most numbering system use positional 
notation : 
N = anrn + an-1rn-1 + … + a1r1 + a0r0 
Where: 
N: an integer with n+1 digits 
r: base 
ai  {0, 1, 2, … , r-1} 
Ebooks.edhole.com
Examples: 
a) N = 278 
r = 10 (base 10) => decimal numbers 
symbol: 0, 1, 2, 3, 4, 5, 6, 
7, 8, 9 (10 different symbols) 
N = 278 => n = 2; 
a2 = 2; a1 = 7; a0 = 8 
278 = (2 x 102) + (7 x 101) + (8 x 100) 
N = anrn + an-1rn-1 + … + a1r1 + a0r0 
Ebooks.edhole.com 
Hundreds Tens Ones
N = anrn + an-1rn-1 + … + a1r1 + a0r0 
b) N = 10012 
r = 2 (base-2) => binary numbers 
symbol: 0, 1 (2 different symbols) 
N = 10012 => n = 3; 
a3 = 1; a2 = 0; a1 = 0; a0 = 1 
10012 = (1 x 23)+(0 x 22)+(0 x 21)+(1 x 20) 
c) N = 2638 
r = 8 (base-8) => Octal numbers 
symbol : 0, 1, 2, 3, 4, 5, 6, 7, 
(8 different symbols) 
N = 2638 => n = 2; a2 = 2; a1 = 6; a0 = 3 
2638 = (2 x 82) + (6 x 81) + (3 x 80) 
Ebooks.edhole.com
d) N = 26316 
r = 16 (base-16) => Hexadecimal 
numbers 
symbol : 0, 1, 2, 3, 4, 5, 6, 7, 8, 
9, A, B, C, D, E, F 
(16 different symbols) 
N = 26316 => n = 2; 
a2 = 2; a1 = 6; a0 = 3 
26316 = (2 x 162)+(6 x 161)+(3 x 160) 
Ebooks.edhole.com
Decimal Binary Octal Hexadecimal 
0 0 0 0 
1 1 1 1 
2 10 2 2 
3 11 3 3 
4 100 4 4 
5 101 5 5 
6 110 6 6 
7 111 7 7 
8 1000 10 8 
9 1001 11 9 
10 1010 12 A 
11 1011 13 B 
12 1100 14 C 
13 1101 15 D 
14 1110 16 E 
15 1111 17 F 
16 10000 20 10 
There are also non-positional numbering systems. 
Example: Roman Number System 
1987 = MCMLXXXVII 
Ebooks.edhole.com
Binary and Decimal 
◦ Converting a decimal number into binary 
(decimal  binary) 
 Divide the decimal number by 2 and take its 
remainder 
 The process is repeated until it produces 
the result of 0 
 The binary number is obtained by taking the 
remainder from the bottom to the top 
Ebooks.edhole.com
5310 => 53 / 2 = 26 remainder 1 
26 / 2 = 13 remainder 0 
13 / 2 = 6 remainder 1 
6 / 2 = 3 remainder 0 
3 / 2 = 1 remainder 1 
1 / 2 = 0 remainder 1 
= 1101012 (6 bits) 
= 001101012 (8 bits) 
(note: bit = binary digit) 
Read from 
the bottom to 
the top 
Ebooks.edhole.com
0.8110 => 0.81 x 2 = 1.62 
0.62 x 2 = 1.24 
0.24 x 2 = 0.48 
0.1100112 
0.48 x 2 = 0.96 
0.96 x 2 = 1.92 
0.92 x 2 = 1.84 
= 0.1100112 (approximately) 
Ebooks.edhole.com
Converting a binary number into decimal 
(binary  decimal) 
Multiply each bit in the binary number 
with the weight (or position) 
Add up all the results of the 
multiplication performed 
The desired decimal number is the 
total of the multiplication results 
performed
a)1110012 (6 bits) 
(1x25) + (1x24) + (1x23) + (0x22) + 
(0x21) + (1x20) 
= 32 + 16 + 8 + 0 + 0 + 1 
= 5710 
b)000110102 (8 bits) 
= 24 + 23 +21 
= 16 + 8 + 2 
= 2610 
Ebooks.edhole.com
Theorem 
If base R1 is the integer power of 
other base, R2, i.e. 
R1 = R2 
d 
e.g., 8 = 23 
Every group of d digits in R2 
(e.g., 3 digits)is equivalent to 
1 digit in the R1 base 
(Note: This theorem is used to convert 
binary numbers to octal and hexadecimal 
or the other way round) 
Ebooks.edhole.com
 From the theorem, assume that 
R1 = 8 (base-8) octal 
R2 = 2 (base-2) binary 
 From the theorem above, 
d 
R1 = R2 
8 = 23 
So, 3 digits in base-2 (binary) is 
equivalent to 1 digit in base-8 
(octal) 
Ebooks.edhole.com
 From the stated theorem, the 
following is a binary-octal 
conversion table. 
Binary Octal 
000 0 
001 1 
010 2 
011 3 
100 4 
101 5 
110 6 
111 7 
In a computer 
system, the 
conversion from 
binary to octal or 
otherwise is based 
on the conversion 
table above. 
3 digits in base-2 (binary) is equivalent to 1 digit in base-8 (octal)
Convert these binary numbers into octal 
numbers: 
(a) 001011112 (8 bits) (b) 111101002 (8 bits) 
Refer to the binary-octal 
conversion table 
000 101 111 
0 5 7 
= 578 
Refer to the binary-octal 
conversion table 
011 110 100 
3 6 4 
= 3648 
Ebooks.edhole.com
Binary and Hexadecimal 
• The same method employed in binary-octal 
conversion is used once again. 
• Assume that: 
R1 = 16 (hexadecimal) 
R2 = 2 (binary) 
• From the theorem: 16 = 24 
Hence, 4 digits in a binary number is 
equivalent to 1 digit in the hexadecimal 
number system (and otherwise) 
• The following is the binary-hexadecimal 
conversion table 
Ebooks.edhole.com
Binary Hexadecimal 
0000 0 
0001 1 
0010 2 
0011 3 
0100 4 
0101 5 
0110 6 
0111 7 
1000 8 
1001 9 
1010 A 
1011 B 
1100 C 
1101 D 
1110 E 
1111 F 
Example: 
1. Convert the following 
binary numbers into 
hexadecimal numbers: 
(a) 001011112 
Refer to the binary-hexadecimal 
conversion table 
above 
0010 11112 = 2F16 
2 F 
Ebooks.edhole.com
Convert the following octal numbers 
into hexadecimal numbers (16 bits) 
(a) 658 (b) 1238 
Refer to the binary-octal conversion table 
68 58 
110 101 
0000 0000 0011 01012 
0 0 3 5 
= 3516 
Refer to the binary-octal conversion table 
18 28 38 
001 010 011 
0000 0000 0101 00112 
0 0 5 3 
= 5316 
octal  binary  hexadecimal
Convert the following hexadecimal 
numbers into binary numbers 
(a) 12B16 (b) ABCD16 
Refer to the binary-hexadecimal 
conversion table 
1 2 B16 
0001 0010 10112 (12 bits) 
= 0001001010112 
Refer to the binary-hexadecimal 
conversion table 
A B C D16 
1010 1011 1101 11102 
= 10101011110111102
 Binary  decimal 
◦ 001100 
◦ 11100.011 
 Decimal  binary 
◦ 145 
◦ 34.75 
 Octal  hexadecimal 
◦ 56558
 Binary  decimal 
◦ 001100 = 12 
◦ 11100.011 = 28.375 
 Decimal  binary 
◦ 145 = 10010001 
◦ 34.75 = 100010.11 
 Octal  hexadecimal 
0 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 0 x 20 = 8 +4 = 12 
145/2 = 72 (reminder 1); 72/2=36(r=0); 36/2=18(r=0); 
18/2=9(r=0); 9/2=4(r=1); 4/2=2(r=0); 2/2=1(r=0); ½=0(r=1) 
octal  binary  decimal  hexadecimal 
◦ 56558 = BAD 
Octal  binary 
101:110:101:101 
Binary  hexadecimal 
1011:1010:1101 
B A D
 Binary  decimal 
◦ 001100 = 12 
◦ 11100.011 = 28.375 
 Decimal  binary 
◦ 145 = 10010001 
◦ 34.75 = 100010.11 
 Octal  hexadecimal 
0x2-1+1x2-2+1x2-3 
0.75 x 2 = 1.5 
0.5 x 2 = 1.0 
octal  binary  hexadecimal 
◦ 56558 = BAD
 Binary  decimal 
◦ 110011.10011 
 Decimal  binary 
◦ 25.25 
 Octal  hexadecimal 
◦ 128 
B 
11001.01 
51.59375
Introduction 
Machine instructions operate on data. The most 
important general categories of data are: 
1. Addresses – unsigned integer 
2. Numbers – integer or fixed point, floating point 
numbers and decimal (eg, BCD (Binary Coded Decimal)) 
3. Characters – IRA (International Reference 
Alphabet), EBCDIC (Extended Binary Coded Decimal 
Interchange Code), ASCII (American Standard Code for 
Information Interchange) 
4. Logical Data 
- Those commonly used by computer users/programmers: signed 
integer, floating point numbers and characters
Integer Representation 
 -1101.01012 = -13.312510 
 Computer storage & processing  
do not have benefit of minus 
signs (-) and periods. 
 Need to represent the integer 
Signed Integer Representation 
 Signed integers are usually used 
by programmers 
 Unsigned integers are used for 
addressing purposes in the 
computer (especially for 
assembly language programmers) 
 Three representations of signed 
integers: 
1. Sign-and-Magnitude 
2. Ones Complement 
3. Twos Complement
 The easiest representation 
 The leftmost bit in the binary number 
represents the sign of the number. 0 
if positive and 1 if negative 
 The balance bits represent the 
magnitude of the number.
Examples: 
i) 8 bits binary number 
__ __ __ __ __ __ __ __ 
7 bits for magnitude (value) 
a) +7 = 0 0 0 0 0 1 1 1 
(–7 = 100001112) 
b) –10 = 1 0 0 0 1 0 1 0 
(+10 = 000010102) 
Sign bit 
0 => +ve 1 => –ve
ii) 6 bits binary number 
__ __ __ __ __ __ 
5 bits for magnitude (value) 
Sign bit 
0 => +ve 1 => –ve 
a) +7 = 0 0 0 1 1 1 
(–7 = 1 0 0 1 1 12) 
b) –10 = 1 0 1 0 1 0 
(+10 = 0 0 1 0 1 02)
 In the ones complement representation, 
positive numbers are same as that of 
sign-and-magnitude 
Example: +5 = 00000101 (8 bit) 
 as in sign-and-magnitude representation 
 Sign-and-magnitude and ones complement 
use the same representation above for +5 
with 8 bits and all positive numbers. 
 For negative numbers, their 
representation are obtained by changing 
bit 0 → 1 and 1 → 0 from their positive 
numbers
Convert –5 into ones complement 
representation (8 bit) 
Solution: 
 First, obtain +5 representation 
in 8 bits  00000101 
 Change every bit in the number 
from 0 to 1 and vice-versa. 
 –510 in ones complement is 
111110102
Get the representation of ones 
complement (6 bit) for the 
following numbers: 
i) +710 ii) –1010 
Solution: 
(+7) = 0001112 
Solution: 
(+10) 
10 
= 0010102 
So, 
(-10) 
10 
= 1101012
 Similar to ones complement, its 
positive number is same as sign-and- 
magnitude 
 Representation of its negative 
number is obtained by adding 1 to 
the ones complement of the 
number.
Convert –5 into twos complement 
representation and give the 
answer in 8 bits. 
Solution: 
 First, obtain +5 representation in 8 
bits  000001012 
 Obtain ones complement for –5 
 111110102 
 Add 1 to the ones complement number: 
 111110102 + 12 = 111110112 
 –5 in twos complement is 111110112
 Obtain representation of twos 
complement (6 bit) for the 
following numbers 
i) +710 ii)–1010 
Solution: 
(+7) = 0001112 
(same as sign-magnitude) 
Solution: 
(+10) 
10 
= 0010102 
(-10) 
10 
= 1101012 + 12 
= 1101102 
So, twos compliment 
for –10 is 1101102
Obtain representation for the following 
numbers 
Decimal Sign-magnitude Twos complement 
+7 
+6 
4 bits 
-4 
-6 
-7 
+18 
-18 
8 bits 
-13
Obtain representation for the following 
numbers 
Decimal Sign-magnitude Twos complement 
+7 0111 0111 
+6 0110 0110 
-4 1100 1100 
-6 1110 1010 
-7 1111 1001 
+18 00010010 00010010 
-18 10010010 11101110 
-13 11110010 11110011
 For character data type, its 
representation uses codes such as the 
ASCII, IRA or EBCDIC. 
Note: Students are encouraged to 
obtain the codes
 In binary, floating point 
numbers are represented in the 
form of : +S x B+E and the number 
can be stored in computer words 
with 3 fields: 
i) Sign (+ve, –ve) 
ii) Significant S 
iii) Exponent E 
and B is base is implicit and 
need not be stored because it is 
the same for all numbers (base- 
2).
1. Addition ( + ) 
010111 
011110 + 
110101 
0 + 0 = 0 
0 + 1 = 1 
1 + 0 = 1 
1 + 1 = 10 
1 + 1 + 1 = (1 + 1) + 1 = 10 + 1 = 112 
Example: 
i. 0101112 + 0111102 = 1101012 
ii. 1000112 + 0111002 = 1111112
2. Multiplication ( x ) 
0 x 0 = 0 
0 x 1 = 0 
1 x 0 = 0 
1 x 1 = 1 
3. Subtraction ( – ) 
0 – 0 = 0 
0 – 1 = 1 (borrow 1) 
1 – 0 = 1 
1 – 1 = 0
4. Division ( / ) 
0 / 1 = 0 
1 / 1 = 1
Example: 
i. 0101112 - 0011102 = 0010012 
ii. 1000112 - 0111002 = 0001112 
Exercise: 
i. 1000100 – 010010 
ii. 1010100 + 1100 
iii. 110100 – 1001 
iv. 11001 x 11 
v. 110111 + 001101 
vi. 111000 + 1100110 
vii. 110100 x 10 
viii. 11001 - 1110
Addition and subtraction for 
signed integers 
Reminder: All subtraction 
operations will be changed into 
addition operations 
Example: 8 – 5 = 8 + (–5) 
–10 + 2 = (–10) + 2 
6 – (–3) = 6 + 3
Z = X + Y 
There are a few possibilities: 
i. If both numbers, X and Y are 
positive 
o Just perform the addition operation 
Example: 
510 + 310 = 0001012 + 0000112 
= 0010002 
= 810
ii. If both numbers are negative 
o Add |X| and |Y| and set the sign bit = 1 
to the result, Z 
Example: –310 – 410 = (–3) + (–4) 
= 1000112 + 1001002 
Only add the magnitude, i.e.: 
000112 + 001002 = 001112 
Set the sign bit of the result 
(Z) to 1 (–ve) 
= 1001112 
= –710
iii. If signs of both number differ 
o There will be 2 cases: 
a) | +ve Number | > | –ve Number | 
Example: (–2) + (+4), (+5) + (–3) 
◦ Set the sign bit of the –ve 
number to 0 (+ve), so that both 
numbers become +ve. 
◦ Subtract the number of smaller 
magnitude from the number with a 
bigger magnitude
Sample solution: 
Change the sign bit of the –ve number to 
+ve 
(–2) + (+4) = 1000102 + 0001002 
= 0001002 – 0000102 
= 0000102 = 210 
b) | –ve Number | > | +ve Number | 
◦ Subtract the +ve number from the –ve number 
Example: (+310) + (–510) 
= 0000112 + 1001012 
= 1001012 – 0000112 
= 1000102 
= –210
 In ones complement, it is easier than sign-and- 
magnitude 
 Change the numbers to its representation 
and perform the addition operation 
 However a situation called Overflow might 
occur when addition is performed on the 
following categories: 
1. If both are negative numbers 
2. If both are in difference sign and 
|+ve Number| > | –ve Number|
Overflow => the addition result 
exceeds the number of bits that was 
fixed 
1. Both are –ve numbers 
Example: –310 – 410 = (–310) + (–410) 
Solution: 
◦Convert –310 and –410 into ones 
complement representation 
+310 = 000000112 (8 bits) 
–310 = 111111002 
+410 = 000001002 (8 bits) 
–410 = 111110112
• Perform the addition operation 
(–310) => 11111100 (8 bit) 
+(–410) => 11111011 (8 bit) 
–710 111110111 (9 bit) 
Overflow occurs. This value is called EAC and needs to be 
added to the rightmost bit. 
11110111 
+ 1 
111110002 = –710 
the answer
2. | +ve Number| > |–ve Number| 
• This case will also cause an 
overflow 
Example: (–2) + 4 = (–2) + (+4) 
Solution: 
• Change both of the numbers above 
into one’s complement 
representation 
–2 = 111111012 +4 = 000001002 
• Add both of the numbers 
(–210) => 11111101 (8 bit) 
+ (+410) => 00000100 (8 bit) 
+210 100000001 (9 bit) 
There is an EAC
• Add the EAC to the rightmost bit 
00000001 
+ 1 
000000102 = +210 
the answer 
Note: 
For cases other than 1 & 2 above, overflow does not occur 
and there will be no EAC and the need to perform addition to 
the rightmost bit does not arise
Addition operation in twos 
complement is same with that of 
ones complement, i.e. overflow 
occurs if: 
1. If both are negative numbers 
2. If both are in difference and 
|+ve Number| > |–ve Number|
Example: –310 – 410 = (–310) + (–410) 
Solution: 
 Convert both numbers into twos 
complement representation 
+310 = 0000112 (6 bit) 
–310 = 1111002 (one’s complement) 
–310 = 1111012 (two’s complement) 
–410 = 1110112 (one’s complement) 
–410 = 1111002 (two’s complement)
 Perform addition operation on 
both the numbers in twos 
complement representation and 
ignore the EAC. 
111100 (–310) 
111011 (–410) 
1111001 
Ignore the 
EAC 
The answer 
= 1110012 (two’s complement) 
= –710
Note: 
In two’s complement, EAC is 
ignored (do not need to be added 
to the leftmost bit, like that of 
one’s complement)
Example: (–2) + 4 = (–2) + (+4) 
Solution: 
 Change both of the numbers above 
into twos complement representation 
–2 = 1111102 +4 = 0001002 
 Perform addition operation on both 
numbers 
(–210) => 111110 (6 bit) 
+ (+410) => 000100 (6 bit) 
+210 1000010 
Ignore the EAC
The answer is 0000102 = +210 
Note: For cases other than 1 and 2 
above, overflow does not occur. 
Exercise: 
Perform the following arithmetic 
operations in ones complement and also 
twos complement 
1. (+2) + (+3) [6 bit] 
2. (–2) + (–3) [6 bit] 
3. (–2) + (+3) [6 bit] 
4. (+2) + (–3) [6 bit] 
Compare your answers with the stated 
theory

Weitere ähnliche Inhalte

Was ist angesagt?

01.number systems
01.number systems01.number systems
01.number systems
rasha3
 
Number system
Number systemNumber system
Number system
aviban
 
2.1 data represent on cpu
2.1 data represent on cpu2.1 data represent on cpu
2.1 data represent on cpu
Wan Afirah
 

Was ist angesagt? (18)

Logic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesLogic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and Codes
 
W 9 numbering system
W 9 numbering systemW 9 numbering system
W 9 numbering system
 
Lesson plan on data representation
Lesson plan on data representationLesson plan on data representation
Lesson plan on data representation
 
01.number systems
01.number systems01.number systems
01.number systems
 
Data representation
Data representationData representation
Data representation
 
Lec 02
Lec 02Lec 02
Lec 02
 
Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009
 
Number system
Number systemNumber system
Number system
 
Number system
Number systemNumber system
Number system
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
2.1 data represent on cpu
2.1 data represent on cpu2.1 data represent on cpu
2.1 data represent on cpu
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
 
Number system
Number systemNumber system
Number system
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Number System | Types of Number System | Binary Number System | Octal Number ...
Number System | Types of Number System | Binary Number System | Octal Number ...Number System | Types of Number System | Binary Number System | Octal Number ...
Number System | Types of Number System | Binary Number System | Octal Number ...
 
number system
number systemnumber system
number system
 
Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbersChapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbers
 
Number System
Number SystemNumber System
Number System
 

Andere mochten auch

Research log for nick grimshaw
Research log for nick grimshawResearch log for nick grimshaw
Research log for nick grimshaw
haverstockmedia
 
Publications of ms.sajina
Publications of ms.sajinaPublications of ms.sajina
Publications of ms.sajina
Savan Mohammed
 
Differentiated curriculum
Differentiated curriculumDifferentiated curriculum
Differentiated curriculum
3256401
 
Globalization in world history
Globalization in world historyGlobalization in world history
Globalization in world history
Hifza Junaid
 
La Biennale de Dakar comme projet de coopération et de développement, Soutena...
La Biennale de Dakar comme projet de coopération et de développement, Soutena...La Biennale de Dakar comme projet de coopération et de développement, Soutena...
La Biennale de Dakar comme projet de coopération et de développement, Soutena...
Iolanda Pensa
 
Research essay presentation
Research essay presentationResearch essay presentation
Research essay presentation
Kamilla Bankston
 
46 smart glasses epson
46 smart glasses epson46 smart glasses epson
46 smart glasses epson
SALMAN SHAIKH
 

Andere mochten auch (20)

Breakfast ok
Breakfast okBreakfast ok
Breakfast ok
 
Faculty of Econ. & Business - Univ. of Alicante - International Policy
Faculty of Econ. & Business -  Univ. of Alicante - International PolicyFaculty of Econ. & Business -  Univ. of Alicante - International Policy
Faculty of Econ. & Business - Univ. of Alicante - International Policy
 
Research log for nick grimshaw
Research log for nick grimshawResearch log for nick grimshaw
Research log for nick grimshaw
 
Post con email_10trends
Post con email_10trendsPost con email_10trends
Post con email_10trends
 
Publications of ms.sajina
Publications of ms.sajinaPublications of ms.sajina
Publications of ms.sajina
 
I do
I doI do
I do
 
21st Century Classroom Ver 1.5
21st Century Classroom Ver 1.521st Century Classroom Ver 1.5
21st Century Classroom Ver 1.5
 
Differentiated curriculum
Differentiated curriculumDifferentiated curriculum
Differentiated curriculum
 
Performance of Optimal Registration Estimator
Performance of Optimal Registration EstimatorPerformance of Optimal Registration Estimator
Performance of Optimal Registration Estimator
 
Nitjsr13
Nitjsr13Nitjsr13
Nitjsr13
 
AWS Enterprise Summit London | British Gas Hive Scaling for the Connected Home
AWS Enterprise Summit London | British Gas Hive Scaling for the Connected HomeAWS Enterprise Summit London | British Gas Hive Scaling for the Connected Home
AWS Enterprise Summit London | British Gas Hive Scaling for the Connected Home
 
Justice in Time: applying TOC to the law courts system in Israel - Shimeon Pa...
Justice in Time: applying TOC to the law courts system in Israel - Shimeon Pa...Justice in Time: applying TOC to the law courts system in Israel - Shimeon Pa...
Justice in Time: applying TOC to the law courts system in Israel - Shimeon Pa...
 
Access Agriculture: Enabling 'Videos for farmers' from global to local level
Access Agriculture: Enabling 'Videos for farmers' from global to local levelAccess Agriculture: Enabling 'Videos for farmers' from global to local level
Access Agriculture: Enabling 'Videos for farmers' from global to local level
 
The reality of break up violence
The reality of break up violenceThe reality of break up violence
The reality of break up violence
 
Globalization in world history
Globalization in world historyGlobalization in world history
Globalization in world history
 
SharePoint Governance - No one should carry the burden alone
SharePoint Governance - No one should carry the burden aloneSharePoint Governance - No one should carry the burden alone
SharePoint Governance - No one should carry the burden alone
 
Oxford heroes-test-book-2
Oxford heroes-test-book-2Oxford heroes-test-book-2
Oxford heroes-test-book-2
 
La Biennale de Dakar comme projet de coopération et de développement, Soutena...
La Biennale de Dakar comme projet de coopération et de développement, Soutena...La Biennale de Dakar comme projet de coopération et de développement, Soutena...
La Biennale de Dakar comme projet de coopération et de développement, Soutena...
 
Research essay presentation
Research essay presentationResearch essay presentation
Research essay presentation
 
46 smart glasses epson
46 smart glasses epson46 smart glasses epson
46 smart glasses epson
 

Ähnlich wie Mba ebooks

chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptxchapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
Surendra Loya
 
LEfddfffhhfrrdvvggfdwfcxsfvdsfgC 02 A.pptx
LEfddfffhhfrrdvvggfdwfcxsfvdsfgC 02 A.pptxLEfddfffhhfrrdvvggfdwfcxsfvdsfgC 02 A.pptx
LEfddfffhhfrrdvvggfdwfcxsfvdsfgC 02 A.pptx
Ahsan433
 
Alu1
Alu1Alu1

Ähnlich wie Mba ebooks (20)

Number_Systems (2).ppt
Number_Systems (2).pptNumber_Systems (2).ppt
Number_Systems (2).ppt
 
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptxchapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
 
Chapter two FHI.pptx
Chapter two FHI.pptxChapter two FHI.pptx
Chapter two FHI.pptx
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
 
Unit 1 PDF.pptx
Unit 1 PDF.pptxUnit 1 PDF.pptx
Unit 1 PDF.pptx
 
08. Numeral Systems
08. Numeral Systems08. Numeral Systems
08. Numeral Systems
 
Chapter_1_Digital_Systems_and_Binary_Numbers2.ppt
Chapter_1_Digital_Systems_and_Binary_Numbers2.pptChapter_1_Digital_Systems_and_Binary_Numbers2.ppt
Chapter_1_Digital_Systems_and_Binary_Numbers2.ppt
 
digital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptxdigital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptx
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptx
 
DLD-Introduction.pptx
DLD-Introduction.pptxDLD-Introduction.pptx
DLD-Introduction.pptx
 
Digital Logic Design.pptx
Digital Logic Design.pptxDigital Logic Design.pptx
Digital Logic Design.pptx
 
unit-i-number-systems.pdf
unit-i-number-systems.pdfunit-i-number-systems.pdf
unit-i-number-systems.pdf
 
LEfddfffhhfrrdvvggfdwfcxsfvdsfgC 02 A.pptx
LEfddfffhhfrrdvvggfdwfcxsfvdsfgC 02 A.pptxLEfddfffhhfrrdvvggfdwfcxsfvdsfgC 02 A.pptx
LEfddfffhhfrrdvvggfdwfcxsfvdsfgC 02 A.pptx
 
Alu1
Alu1Alu1
Alu1
 
Ncp computer appls num sys2 pramod
Ncp computer appls  num sys2 pramodNcp computer appls  num sys2 pramod
Ncp computer appls num sys2 pramod
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1
 
Chapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptChapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.ppt
 
08 Numeral systems
08 Numeral systems08 Numeral systems
08 Numeral systems
 
21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx
 
2013 1
2013 1 2013 1
2013 1
 

Mehr von Edhole.com

Mehr von Edhole.com (20)

Ca in patna
Ca in patnaCa in patna
Ca in patna
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarka
 
Ca in dwarka
Ca in dwarkaCa in dwarka
Ca in dwarka
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarka
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in surat
 
Website dsigning company in india
Website dsigning company in indiaWebsite dsigning company in india
Website dsigning company in india
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhi
 
Ca in patna
Ca in patnaCa in patna
Ca in patna
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarka
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarka
 
Ca in dwarka
Ca in dwarkaCa in dwarka
Ca in dwarka
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in surat
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in india
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhi
 
Website designing company in mumbai
Website designing company in mumbaiWebsite designing company in mumbai
Website designing company in mumbai
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website desinging company in surat
Website desinging company in suratWebsite desinging company in surat
Website desinging company in surat
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in india
 

Kürzlich hochgeladen

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 

Mba ebooks

  • 2. 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other number system 2.3 Representation of integer, character and floating point numbers in binary 2.4 Binary Arithmetic 2.5 Arithmetic Operations for One’s Complement, Two’s Complement, magnitude and sign and floating point number Ebooks.edhole.com
  • 3. Most numbering system use positional notation : N = anrn + an-1rn-1 + … + a1r1 + a0r0 Where: N: an integer with n+1 digits r: base ai  {0, 1, 2, … , r-1} Ebooks.edhole.com
  • 4. Examples: a) N = 278 r = 10 (base 10) => decimal numbers symbol: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (10 different symbols) N = 278 => n = 2; a2 = 2; a1 = 7; a0 = 8 278 = (2 x 102) + (7 x 101) + (8 x 100) N = anrn + an-1rn-1 + … + a1r1 + a0r0 Ebooks.edhole.com Hundreds Tens Ones
  • 5. N = anrn + an-1rn-1 + … + a1r1 + a0r0 b) N = 10012 r = 2 (base-2) => binary numbers symbol: 0, 1 (2 different symbols) N = 10012 => n = 3; a3 = 1; a2 = 0; a1 = 0; a0 = 1 10012 = (1 x 23)+(0 x 22)+(0 x 21)+(1 x 20) c) N = 2638 r = 8 (base-8) => Octal numbers symbol : 0, 1, 2, 3, 4, 5, 6, 7, (8 different symbols) N = 2638 => n = 2; a2 = 2; a1 = 6; a0 = 3 2638 = (2 x 82) + (6 x 81) + (3 x 80) Ebooks.edhole.com
  • 6. d) N = 26316 r = 16 (base-16) => Hexadecimal numbers symbol : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F (16 different symbols) N = 26316 => n = 2; a2 = 2; a1 = 6; a0 = 3 26316 = (2 x 162)+(6 x 161)+(3 x 160) Ebooks.edhole.com
  • 7. Decimal Binary Octal Hexadecimal 0 0 0 0 1 1 1 1 2 10 2 2 3 11 3 3 4 100 4 4 5 101 5 5 6 110 6 6 7 111 7 7 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F 16 10000 20 10 There are also non-positional numbering systems. Example: Roman Number System 1987 = MCMLXXXVII Ebooks.edhole.com
  • 8. Binary and Decimal ◦ Converting a decimal number into binary (decimal  binary)  Divide the decimal number by 2 and take its remainder  The process is repeated until it produces the result of 0  The binary number is obtained by taking the remainder from the bottom to the top Ebooks.edhole.com
  • 9. 5310 => 53 / 2 = 26 remainder 1 26 / 2 = 13 remainder 0 13 / 2 = 6 remainder 1 6 / 2 = 3 remainder 0 3 / 2 = 1 remainder 1 1 / 2 = 0 remainder 1 = 1101012 (6 bits) = 001101012 (8 bits) (note: bit = binary digit) Read from the bottom to the top Ebooks.edhole.com
  • 10. 0.8110 => 0.81 x 2 = 1.62 0.62 x 2 = 1.24 0.24 x 2 = 0.48 0.1100112 0.48 x 2 = 0.96 0.96 x 2 = 1.92 0.92 x 2 = 1.84 = 0.1100112 (approximately) Ebooks.edhole.com
  • 11. Converting a binary number into decimal (binary  decimal) Multiply each bit in the binary number with the weight (or position) Add up all the results of the multiplication performed The desired decimal number is the total of the multiplication results performed
  • 12. a)1110012 (6 bits) (1x25) + (1x24) + (1x23) + (0x22) + (0x21) + (1x20) = 32 + 16 + 8 + 0 + 0 + 1 = 5710 b)000110102 (8 bits) = 24 + 23 +21 = 16 + 8 + 2 = 2610 Ebooks.edhole.com
  • 13. Theorem If base R1 is the integer power of other base, R2, i.e. R1 = R2 d e.g., 8 = 23 Every group of d digits in R2 (e.g., 3 digits)is equivalent to 1 digit in the R1 base (Note: This theorem is used to convert binary numbers to octal and hexadecimal or the other way round) Ebooks.edhole.com
  • 14.  From the theorem, assume that R1 = 8 (base-8) octal R2 = 2 (base-2) binary  From the theorem above, d R1 = R2 8 = 23 So, 3 digits in base-2 (binary) is equivalent to 1 digit in base-8 (octal) Ebooks.edhole.com
  • 15.  From the stated theorem, the following is a binary-octal conversion table. Binary Octal 000 0 001 1 010 2 011 3 100 4 101 5 110 6 111 7 In a computer system, the conversion from binary to octal or otherwise is based on the conversion table above. 3 digits in base-2 (binary) is equivalent to 1 digit in base-8 (octal)
  • 16. Convert these binary numbers into octal numbers: (a) 001011112 (8 bits) (b) 111101002 (8 bits) Refer to the binary-octal conversion table 000 101 111 0 5 7 = 578 Refer to the binary-octal conversion table 011 110 100 3 6 4 = 3648 Ebooks.edhole.com
  • 17. Binary and Hexadecimal • The same method employed in binary-octal conversion is used once again. • Assume that: R1 = 16 (hexadecimal) R2 = 2 (binary) • From the theorem: 16 = 24 Hence, 4 digits in a binary number is equivalent to 1 digit in the hexadecimal number system (and otherwise) • The following is the binary-hexadecimal conversion table Ebooks.edhole.com
  • 18. Binary Hexadecimal 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 A 1011 B 1100 C 1101 D 1110 E 1111 F Example: 1. Convert the following binary numbers into hexadecimal numbers: (a) 001011112 Refer to the binary-hexadecimal conversion table above 0010 11112 = 2F16 2 F Ebooks.edhole.com
  • 19. Convert the following octal numbers into hexadecimal numbers (16 bits) (a) 658 (b) 1238 Refer to the binary-octal conversion table 68 58 110 101 0000 0000 0011 01012 0 0 3 5 = 3516 Refer to the binary-octal conversion table 18 28 38 001 010 011 0000 0000 0101 00112 0 0 5 3 = 5316 octal  binary  hexadecimal
  • 20. Convert the following hexadecimal numbers into binary numbers (a) 12B16 (b) ABCD16 Refer to the binary-hexadecimal conversion table 1 2 B16 0001 0010 10112 (12 bits) = 0001001010112 Refer to the binary-hexadecimal conversion table A B C D16 1010 1011 1101 11102 = 10101011110111102
  • 21.  Binary  decimal ◦ 001100 ◦ 11100.011  Decimal  binary ◦ 145 ◦ 34.75  Octal  hexadecimal ◦ 56558
  • 22.  Binary  decimal ◦ 001100 = 12 ◦ 11100.011 = 28.375  Decimal  binary ◦ 145 = 10010001 ◦ 34.75 = 100010.11  Octal  hexadecimal 0 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 0 x 20 = 8 +4 = 12 145/2 = 72 (reminder 1); 72/2=36(r=0); 36/2=18(r=0); 18/2=9(r=0); 9/2=4(r=1); 4/2=2(r=0); 2/2=1(r=0); ½=0(r=1) octal  binary  decimal  hexadecimal ◦ 56558 = BAD Octal  binary 101:110:101:101 Binary  hexadecimal 1011:1010:1101 B A D
  • 23.  Binary  decimal ◦ 001100 = 12 ◦ 11100.011 = 28.375  Decimal  binary ◦ 145 = 10010001 ◦ 34.75 = 100010.11  Octal  hexadecimal 0x2-1+1x2-2+1x2-3 0.75 x 2 = 1.5 0.5 x 2 = 1.0 octal  binary  hexadecimal ◦ 56558 = BAD
  • 24.  Binary  decimal ◦ 110011.10011  Decimal  binary ◦ 25.25  Octal  hexadecimal ◦ 128 B 11001.01 51.59375
  • 25. Introduction Machine instructions operate on data. The most important general categories of data are: 1. Addresses – unsigned integer 2. Numbers – integer or fixed point, floating point numbers and decimal (eg, BCD (Binary Coded Decimal)) 3. Characters – IRA (International Reference Alphabet), EBCDIC (Extended Binary Coded Decimal Interchange Code), ASCII (American Standard Code for Information Interchange) 4. Logical Data - Those commonly used by computer users/programmers: signed integer, floating point numbers and characters
  • 26. Integer Representation  -1101.01012 = -13.312510  Computer storage & processing  do not have benefit of minus signs (-) and periods.  Need to represent the integer 
  • 27. Signed Integer Representation  Signed integers are usually used by programmers  Unsigned integers are used for addressing purposes in the computer (especially for assembly language programmers)  Three representations of signed integers: 1. Sign-and-Magnitude 2. Ones Complement 3. Twos Complement
  • 28.  The easiest representation  The leftmost bit in the binary number represents the sign of the number. 0 if positive and 1 if negative  The balance bits represent the magnitude of the number.
  • 29. Examples: i) 8 bits binary number __ __ __ __ __ __ __ __ 7 bits for magnitude (value) a) +7 = 0 0 0 0 0 1 1 1 (–7 = 100001112) b) –10 = 1 0 0 0 1 0 1 0 (+10 = 000010102) Sign bit 0 => +ve 1 => –ve
  • 30. ii) 6 bits binary number __ __ __ __ __ __ 5 bits for magnitude (value) Sign bit 0 => +ve 1 => –ve a) +7 = 0 0 0 1 1 1 (–7 = 1 0 0 1 1 12) b) –10 = 1 0 1 0 1 0 (+10 = 0 0 1 0 1 02)
  • 31.  In the ones complement representation, positive numbers are same as that of sign-and-magnitude Example: +5 = 00000101 (8 bit)  as in sign-and-magnitude representation  Sign-and-magnitude and ones complement use the same representation above for +5 with 8 bits and all positive numbers.  For negative numbers, their representation are obtained by changing bit 0 → 1 and 1 → 0 from their positive numbers
  • 32. Convert –5 into ones complement representation (8 bit) Solution:  First, obtain +5 representation in 8 bits  00000101  Change every bit in the number from 0 to 1 and vice-versa.  –510 in ones complement is 111110102
  • 33. Get the representation of ones complement (6 bit) for the following numbers: i) +710 ii) –1010 Solution: (+7) = 0001112 Solution: (+10) 10 = 0010102 So, (-10) 10 = 1101012
  • 34.  Similar to ones complement, its positive number is same as sign-and- magnitude  Representation of its negative number is obtained by adding 1 to the ones complement of the number.
  • 35. Convert –5 into twos complement representation and give the answer in 8 bits. Solution:  First, obtain +5 representation in 8 bits  000001012  Obtain ones complement for –5  111110102  Add 1 to the ones complement number:  111110102 + 12 = 111110112  –5 in twos complement is 111110112
  • 36.  Obtain representation of twos complement (6 bit) for the following numbers i) +710 ii)–1010 Solution: (+7) = 0001112 (same as sign-magnitude) Solution: (+10) 10 = 0010102 (-10) 10 = 1101012 + 12 = 1101102 So, twos compliment for –10 is 1101102
  • 37. Obtain representation for the following numbers Decimal Sign-magnitude Twos complement +7 +6 4 bits -4 -6 -7 +18 -18 8 bits -13
  • 38. Obtain representation for the following numbers Decimal Sign-magnitude Twos complement +7 0111 0111 +6 0110 0110 -4 1100 1100 -6 1110 1010 -7 1111 1001 +18 00010010 00010010 -18 10010010 11101110 -13 11110010 11110011
  • 39.  For character data type, its representation uses codes such as the ASCII, IRA or EBCDIC. Note: Students are encouraged to obtain the codes
  • 40.  In binary, floating point numbers are represented in the form of : +S x B+E and the number can be stored in computer words with 3 fields: i) Sign (+ve, –ve) ii) Significant S iii) Exponent E and B is base is implicit and need not be stored because it is the same for all numbers (base- 2).
  • 41.
  • 42. 1. Addition ( + ) 010111 011110 + 110101 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10 1 + 1 + 1 = (1 + 1) + 1 = 10 + 1 = 112 Example: i. 0101112 + 0111102 = 1101012 ii. 1000112 + 0111002 = 1111112
  • 43. 2. Multiplication ( x ) 0 x 0 = 0 0 x 1 = 0 1 x 0 = 0 1 x 1 = 1 3. Subtraction ( – ) 0 – 0 = 0 0 – 1 = 1 (borrow 1) 1 – 0 = 1 1 – 1 = 0
  • 44. 4. Division ( / ) 0 / 1 = 0 1 / 1 = 1
  • 45. Example: i. 0101112 - 0011102 = 0010012 ii. 1000112 - 0111002 = 0001112 Exercise: i. 1000100 – 010010 ii. 1010100 + 1100 iii. 110100 – 1001 iv. 11001 x 11 v. 110111 + 001101 vi. 111000 + 1100110 vii. 110100 x 10 viii. 11001 - 1110
  • 46. Addition and subtraction for signed integers Reminder: All subtraction operations will be changed into addition operations Example: 8 – 5 = 8 + (–5) –10 + 2 = (–10) + 2 6 – (–3) = 6 + 3
  • 47. Z = X + Y There are a few possibilities: i. If both numbers, X and Y are positive o Just perform the addition operation Example: 510 + 310 = 0001012 + 0000112 = 0010002 = 810
  • 48. ii. If both numbers are negative o Add |X| and |Y| and set the sign bit = 1 to the result, Z Example: –310 – 410 = (–3) + (–4) = 1000112 + 1001002 Only add the magnitude, i.e.: 000112 + 001002 = 001112 Set the sign bit of the result (Z) to 1 (–ve) = 1001112 = –710
  • 49. iii. If signs of both number differ o There will be 2 cases: a) | +ve Number | > | –ve Number | Example: (–2) + (+4), (+5) + (–3) ◦ Set the sign bit of the –ve number to 0 (+ve), so that both numbers become +ve. ◦ Subtract the number of smaller magnitude from the number with a bigger magnitude
  • 50. Sample solution: Change the sign bit of the –ve number to +ve (–2) + (+4) = 1000102 + 0001002 = 0001002 – 0000102 = 0000102 = 210 b) | –ve Number | > | +ve Number | ◦ Subtract the +ve number from the –ve number Example: (+310) + (–510) = 0000112 + 1001012 = 1001012 – 0000112 = 1000102 = –210
  • 51.  In ones complement, it is easier than sign-and- magnitude  Change the numbers to its representation and perform the addition operation  However a situation called Overflow might occur when addition is performed on the following categories: 1. If both are negative numbers 2. If both are in difference sign and |+ve Number| > | –ve Number|
  • 52. Overflow => the addition result exceeds the number of bits that was fixed 1. Both are –ve numbers Example: –310 – 410 = (–310) + (–410) Solution: ◦Convert –310 and –410 into ones complement representation +310 = 000000112 (8 bits) –310 = 111111002 +410 = 000001002 (8 bits) –410 = 111110112
  • 53. • Perform the addition operation (–310) => 11111100 (8 bit) +(–410) => 11111011 (8 bit) –710 111110111 (9 bit) Overflow occurs. This value is called EAC and needs to be added to the rightmost bit. 11110111 + 1 111110002 = –710 the answer
  • 54. 2. | +ve Number| > |–ve Number| • This case will also cause an overflow Example: (–2) + 4 = (–2) + (+4) Solution: • Change both of the numbers above into one’s complement representation –2 = 111111012 +4 = 000001002 • Add both of the numbers (–210) => 11111101 (8 bit) + (+410) => 00000100 (8 bit) +210 100000001 (9 bit) There is an EAC
  • 55. • Add the EAC to the rightmost bit 00000001 + 1 000000102 = +210 the answer Note: For cases other than 1 & 2 above, overflow does not occur and there will be no EAC and the need to perform addition to the rightmost bit does not arise
  • 56. Addition operation in twos complement is same with that of ones complement, i.e. overflow occurs if: 1. If both are negative numbers 2. If both are in difference and |+ve Number| > |–ve Number|
  • 57. Example: –310 – 410 = (–310) + (–410) Solution:  Convert both numbers into twos complement representation +310 = 0000112 (6 bit) –310 = 1111002 (one’s complement) –310 = 1111012 (two’s complement) –410 = 1110112 (one’s complement) –410 = 1111002 (two’s complement)
  • 58.  Perform addition operation on both the numbers in twos complement representation and ignore the EAC. 111100 (–310) 111011 (–410) 1111001 Ignore the EAC The answer = 1110012 (two’s complement) = –710
  • 59. Note: In two’s complement, EAC is ignored (do not need to be added to the leftmost bit, like that of one’s complement)
  • 60. Example: (–2) + 4 = (–2) + (+4) Solution:  Change both of the numbers above into twos complement representation –2 = 1111102 +4 = 0001002  Perform addition operation on both numbers (–210) => 111110 (6 bit) + (+410) => 000100 (6 bit) +210 1000010 Ignore the EAC
  • 61. The answer is 0000102 = +210 Note: For cases other than 1 and 2 above, overflow does not occur. Exercise: Perform the following arithmetic operations in ones complement and also twos complement 1. (+2) + (+3) [6 bit] 2. (–2) + (–3) [6 bit] 3. (–2) + (+3) [6 bit] 4. (+2) + (–3) [6 bit] Compare your answers with the stated theory