SlideShare a Scribd company logo
Dr. Anita Goel
Assoc. Prof. (Computer Sci.)
Dyal Singh College, University of Delhi
 Introduction
 Binary Arithmetic
 Signed and Unsigned Numbers
 Binary Data Representation
 Binary Coding Schemes
2
 Uses digits 0-9
 Digits combined to form numbers like 104,
4561
 Decimal arithmetic operations
 Addition, subtraction, multiplication, division
 For e.g., a chocolate costs Rs. 5/-. Total
cost of 2 chocolates will be Rs. 10/- i.e.
(5*2) or (5+5)
3
 Used in computer systems
 Uses digits 0’s and 1’s only
 Digits combined to form numbers like
1001, 11000110
 A digit 0 or 1 is called a bit (binary digit)
 1001 is a 4-bit number.
 11000110 is an 8-bit number
4
 All data is represented internally in a
computer by a combination of bits.
 Each symbol is represented by a
combination of bits.
5
 Arithmetic operations performed on binary
numbers is called binary arithmetic.
 addition, subtraction, multiplication, division.
 Computer systems actually perform only
Binary Addition and Binary Subtraction.
 Binary Multiplication and Division is
performed using some simple operations
6
 Involves addition of two or more binary
numbers.
 Uses Binary addition rules
7
8
Input 1 Input 2 Sum Carry
0 0 0 No carry
0 1 1 No carry
1 0 1 No carry
1 1 0 1
9
Input 1 Input 2 Input 3 Sum Carry
1 1 1 1 1
1. Start by adding bits in unit column (rightmost
column)
2. Result of adding bits of a column is a sum with
or without a carry.
3. Write sum in result of that column.
4. If carry is present, carry is carried-over to
addition of the adjacent left column.
5. Then repeat the above steps, for each of the
columns, i.e., tens column, hundreds column
and so on.
10
Example 1. Add 10 and 01. Verify answer with the
help of decimal addition.
11
Binary Addition
1 0
+ 0 1
11
Decimal Addition
2
1+
3
112 = 310
Example 2. Add 01 and 11. Verify answer with the
help of decimal addition.
12
Binary Addition
0 1
+ 1 1
00
Decimal Addition
1
3+
4
1
1
1002 = 410
Example 3. Add 11 and 11. Verify answer with the
help of decimal addition.
13
Binary Addition
1 1
+ 1 1
01
Decimal Addition
3
3+
6
1
1
1102 = 610
Example 4. Add 1101 and 1111. Verify answer with
the help of decimal addition.
14
Binary Addition
1 1 0 1
+ 1 1 1 1
01
Decimal Addition
1 3
1 5+
2 8
1
1
11
01
111002 = 2810
Example 5. Add 10111, 11100 and 11. Verify answer
with the help of decimal addition.
15
Binary Addition
1 0 1 1 1
1 1 1 0 0
+ 1 1
01
Decimal Addition
2 3
2 8
3+
5 4
1
0
11
11
1
1
1101102 = 5410
 Uses Binary subtraction rules
16
Input 1 Input 2 Difference Borrow
0 0 0 No borrow
0 1 1 1
1 0 1 No borrow
1 1 0 No borrow
Binary Subtraction Rules
1. Start by subtracting bit in lower row from bit in
upper row, in unit column.
2. If bit in upper row is less than the bit in lower row,
borrow 1 from upper row of adjacent left column.
3. Result of subtracting two bits is the difference.
4. Write difference in result of that column.
5. Then repeat the above steps, for each of the
columns, i.e., tens column, hundreds column and
so on.
17
Example 1. Subtract 01 from 11. Verify answer
with the help of decimal subtraction.
18
Binary Subtraction
1 1
- 0 1
01
Decimal Subtraction
3
1-
2
102 = 210
Example 2. Subtract 01 from 10. Verify answer
with the help of decimal subtraction.
19
Binary Subtraction
1 0
- 0 1
10
Decimal Subtraction
2
1-
1
10
012 = 110
0
Example 3. Subtract 0111 from 1110. Verify answer
with the help of decimal subtraction.
20
Binary Subtraction
1 1 1 0
- 0 1 1 1
10
Decimal Subtraction
1 4
7-
7
10
10
11
10
01112 = 710
000
Example 4 Subtract 10010 from 10101. Verify
answer with the help of decimal
subtraction.
21
Binary Subtraction
1 0 1 0 1
- 1 0 0 1 0
10
Decimal Subtraction
2 1
1 8-
3
10
100
000112 = 310
0
Example 5. Subtract 101111 from 110001. Verify
answer with the help of decimal
subtraction.
22
Binary Subtraction
1 1 0 0 0 1
- 1 0 1 1 1 1
10
Decimal Subtraction
4 9
4 7-
2
101010
00 0 0
11
0000102 = 210
0
 A binary number may be positive or
negative.
 Generally, symbols “+” and “-” represent
positive and negative numbers,
respectively.
 In computer, sign of a binary number has
to be represented using 0 and 1.
23
 n-bit signed binary number consists of two parts
 Sign bit, and Magnitude.
 Left most bit is called Most Significant Bit (MSB).
 MSB is the sign bit.
 Remaining n-1 bits denote magnitude of number.
24
MSB
Sign bit Magnitude
1 bit n-1 bits
 Sign bit is 0 for a positive number and 1 for
a negative number.
 0 1100011 is a positive number. Sign bit is 0,
and,
 1 1001011 is a negative number. Sign bit is 1.
25
0 1100011
MSB
1 1001011
MSB
Positive Number Negative Number
 Data range for 8-bit signed number is:
 -128 to +127 (-27 to +27-1).
 Leftmost bit is sign bit.
 In n-bit unsigned binary number,
magnitude of number n is stored in n bits.
 Data range for 8-bit unsigned number is:
 0 to 255 (28= 256).
26
 Used in computer for simplification of
subtraction operation.
 Two types of complements
 1’s complement, and
 2’ s complement.
27
 Change bits 1 to 0 and bits 0 to 1.
 Some examples
Binary
Numbers
1’s
Complement
28
1 1 0
0 0 1
1 0 1 1
0 1 0 0 0 0 1 0 0 0 0
1 1 0 1 1 1 1
 Add 1 to the 1’s complement of the binary number.
 Some Examples:
Binary
Numbers
1’s
Complement
2’s
Complement
29
0 1 0 0 1 0 1 0 0 1 0 0 0 1
1 1 0 1 0 1 1 1 1 0 1 1 1 1
0 0 1 0 1 0 0 0 0 1 0 0 0 0
 Binary number can also have a binary
point, in addition to sign.
 Binary point used for representing
fractions, integers and integer-fraction
numbers.
 Registers are high-speed storage areas in
CPU of computer. All data is brought into a
register before it gets processed.
30
 Two ways of representing position of
binary point in a register
 Fixed Point Number Representation, and
 Floating Point Number Representation.
31
 Assumes binary point is fixed at one position.
 Represents +ve integer binary signed number as-
 Sign bit is 0. Magnitude is a positive binary number.
 Represents -ve integer binary signed number as-
 Sign bit is 1
 Magnitude is represented in any one of three ways-
 Signed Magnitude representation
 Signed 1’s complement representation
 Signed 2’s complement representation
32
 Signed Magnitude representation
 Magnitude is positive binary number itself.
 Signed 1’s complement representation
 Magnitude is 1’s complement of positive binary
number.
 Signed 2’s complement representation
 Magnitude is 2’s complement of positive binary
number.
33
+18
0 0 0 1 0 0 1 0
Sign bit is 0 Binary equivalent of +18
-18
Signed
magnitude
representation
1 0 0 1 0 0 1 0
Sign bit is 1 Binary equivalent of +18
Signed 1’s
complement
representation
1 1 1 0 1 1 0 1
Sign bit is 1 1’s complement of +18
Signed 2’s
complement
representation
1 1 1 0 1 1 1 0
Sign bit is 1 2’s complement of +18
Fixed Point Representation of
Signed Number 18
34
 Signed magnitude and signed 1’s
complement representation are rarely used
in computer arithmetic.
 Signed 2’s complement representation is
used to represent negative numbers.
35
 Represent positive number in binary form.
 For e.g., +5 is 0000 0101, +10 is 0000 1010
 Represent negative number in 2’s
complement form.
 For e.g., -5 is 111 1 1011, -10 is 1111 0110
 Add bits of the two signed binary numbers.
 Ignore any carry out from sign bit position.
36
 Negative output is automatically in 2’s
complement form.
 Get decimal equivalent of negative output
number
 Find its 2’s complement, and
 Attach a negative sign to the obtained result.
37
Example 1. Add binary +5 and +10. Verify answer
with the help of decimal addition.
38
Binary Addition
0 0 0 0 0 1 0 1
+ 0 0 0 0 1 0 1 0
0 100 0
Decimal Addition
5
1 0+
1 5
+
+1 11
0000 11112 = +1510
Example 2. Add binary -5 and +10. Verify answer
with the help of decimal addition.
39
Binary Addition
1 1 1 1 1 0 1 1
+ 0 0 0 0 1 0 1 0
0 000 0
Decimal Addition
5
1 0+
5
-
+0 11
111111
0000 01012 = +510
Example 3. Add binary +5 and -10. Verify answer
with the help of decimal addition.
40
Binary Addition
0 0 0 0 0 1 0 1
+ 1 1 1 1 0 1 1 0
1 111 1
Decimal Addition
5
1 0-
5
+
-1 10
1
1111 10112 = -510
Example 4. Add binary -5 and -10. Verify answer
with the help of decimal addition.
41
Binary Addition
1 1 1 1 1 0 1 1
+ 1 1 1 1 0 1 1 0
1 011 1
Decimal Addition
5
1 0-
1 5
-
-0 10
111 1 11 1
1111 00012 = -1510
 Changed to addition of two signed numbers.
 Sign of second number is changed before
performing the addition operation.
42
(+A) – (+B) = (+A) + (-B)
(+A) – (-B) = (+A) + (+B)
(-A) – (-B) = (-A) + (+B)
(-A) – (+B) = (-A) + (-B)
43
 Uses two registers
 1st register stores number without binary point.
 2nd register stores a number that indicates position
of binary point in first register.
 Consists of two parts:
 Mantissa, and Exponent.
 Mantissa is a signed fixed point number.
 Exponent shows position of binary point in
mantissa.
44
45
Represent binary number +11001.11 with
8-bit mantissa and 6-bit exponent
Floating point number is: Mantissa x 2exponent
+ (.1100111) x 2+5.
Mantissa Exponent
number is positive binary equivalent of +5
0 11 0 0 111 0 0 0 1 0 1
11 0 0 1 . 11 . 11 0 0 111 x 2 5
 Data - alphabetic, numeric, alphanumeric,
sound, video.
 Data represented as combination of bits in
computer.
 Bits are grouped in a fixed size.
 Code is made by combining bits of definite
size.
46
 Represents symbols in a standard code.
 Combination of bits represents a unique
symbol.
 Standard code enables programmers to
use same combination of bits to represent
a symbol in data.
47
 Commonly used binary coding schemes:
 ASCII,
 EBCDIC, and
 Unicode
48
 EBCDIC stands for Extended Binary Coded
Decimal Interchange Code
 8-bit code. 4 bits for zone; 4 bits for digit.
 Allows 28 = 256 combinations.
 Represents 256 unique symbols.
 Used mainly in mainframe computers.
49
 ASCII stands for American Standard Code
for Information Interchange
 Two types of ASCII codes
 ASCII-7 and
 ASCII-8.
50
 Standard ASCII code.
 7-bit code. 3 bits for zone; 4 bits for digits.
 Allows 27 = 128 combinations.
 Represents 128 unique symbols.
 ASCII-7 modified by IBM to ASCII-8.
51
 Extended version of ASCII-7.
 8-bit code. 4 bits for zone; 4 bits for digit.
 Allows 28 = 256 combinations.
 Represents 256 unique symbols.
 Widely used to represent data in computer.
52
 ASCII-8 code represents 256 symbols.
 0-31 for control characters.
 Non-printable. Carriage Return (CR), Bell
(BEL).
 48-57 for numeric 0-9.
 65-90 for uppercase letters A-Z.
 97-122 for lowercase letters a-z.
 128-255 are extended ASCII codes.
53
 Universal character encoding standard
 Represents text, symbols, characters in multi-
lingual environments.
 Uniquely represent a symbol in languages like
Chinese, Japanese etc.
 Represents mathematical and scientific
symbols.
 32 bit code.
 Allows 232 = approx. 4 billion combinations.
54
 Compatible with ASCII-8 codes.
 Unicode’s first 256 codes identical to ASCII-
8 codes.
 Implemented by character encodings.
 UTF-8 : A character encoding
 Most commonly used encoding scheme.
 Uses 8-32 bits per code.
55
Unicode character encoding
in MS-Word 2007
56
Binaty Arithmetic and Binary coding schemes

More Related Content

PPTX
Binary arithmetic
PPT
Boolean Algebra
PPTX
Binary true ppt
PPTX
Design half ,full Adder and Subtractor
PDF
Binary Arithmetic Operations
PPT
adder and subtractor
PDF
Floating point presentation
PPTX
1's and 2's complement
Binary arithmetic
Boolean Algebra
Binary true ppt
Design half ,full Adder and Subtractor
Binary Arithmetic Operations
adder and subtractor
Floating point presentation
1's and 2's complement

What's hot (20)

PPT
BCD,GRAY and EXCESS 3 codes
PPT
1’s and 2’s complements
PPTX
PPTX
Binary addition and subtraction
PDF
Slide03 Number System and Operations Part 1
PPTX
Subtractor (1)
PPTX
Adder ppt
PPT
13 Boolean Algebra
PDF
Digital and Logic Design Chapter 1 binary_systems
PDF
Binary codes
PPT
Binary Arithmetic
PPTX
Combinational circuit
PDF
Signed Binary Numbers
PPSX
Basic of number system
PPTX
Parity Generator and Parity Checker
PPTX
Full custom digital ic design of priority encoder
PPTX
Number system in Digital Electronics
PPT
Boolean algebra And Logic Gates
PPT
decoder and encoder
PPTX
Code conversion
BCD,GRAY and EXCESS 3 codes
1’s and 2’s complements
Binary addition and subtraction
Slide03 Number System and Operations Part 1
Subtractor (1)
Adder ppt
13 Boolean Algebra
Digital and Logic Design Chapter 1 binary_systems
Binary codes
Binary Arithmetic
Combinational circuit
Signed Binary Numbers
Basic of number system
Parity Generator and Parity Checker
Full custom digital ic design of priority encoder
Number system in Digital Electronics
Boolean algebra And Logic Gates
decoder and encoder
Code conversion
Ad

Similar to Binaty Arithmetic and Binary coding schemes (20)

PPTX
Computer Architecture
PPTX
Computer Architecture
PPT
Number system and codes
PDF
Finite word length effects
PPT
Counit2
PDF
Computer Architecture: ARITHMETIC FOR COMPUTERS
PPTX
module 1_class_numbers.pptx
PPTX
CA Unit ii
PPTX
ARITHMETIC FOR COMPUTERS
PPT
Digital fundamendals r001a
PPT
Comp Arithmetic Basic.ppt
PPT
ch3a-binary-numbers.ppt
PPTX
DEC Unit 1 Full-1.pptx Boolean Algebra and Logic gates
PPT
Chapter 02 Data Types
PPTX
computer organization-computer organization-
PPT
ch3a-binary-numbers.ppt
PPT
ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt
PPT
ch3a-binary-numbers.ppt
PPT
Review on Number Systems: Decimal, Binary, and Hexadecimal
PPT
binary-numbers.ppt
Computer Architecture
Computer Architecture
Number system and codes
Finite word length effects
Counit2
Computer Architecture: ARITHMETIC FOR COMPUTERS
module 1_class_numbers.pptx
CA Unit ii
ARITHMETIC FOR COMPUTERS
Digital fundamendals r001a
Comp Arithmetic Basic.ppt
ch3a-binary-numbers.ppt
DEC Unit 1 Full-1.pptx Boolean Algebra and Logic gates
Chapter 02 Data Types
computer organization-computer organization-
ch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
Review on Number Systems: Decimal, Binary, and Hexadecimal
binary-numbers.ppt
Ad

More from Dr. Anita Goel (6)

PDF
Big data and cloud computing 9 sep-2017
PDF
Scientific writing anita goel du
PDF
Cloud computing infrastructure
PDF
MOOC and OER for Student Participation and Collaborative Learning
PDF
Good governance through e-Governance
PDF
Open office impress
Big data and cloud computing 9 sep-2017
Scientific writing anita goel du
Cloud computing infrastructure
MOOC and OER for Student Participation and Collaborative Learning
Good governance through e-Governance
Open office impress

Recently uploaded (20)

PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Pharma ospi slides which help in ospi learning
PPH.pptx obstetrics and gynecology in nursing
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Supply Chain Operations Speaking Notes -ICLT Program
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
RMMM.pdf make it easy to upload and study
Pharmacology of Heart Failure /Pharmacotherapy of CHF
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
102 student loan defaulters named and shamed – Is someone you know on the list?
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Sports Quiz easy sports quiz sports quiz
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
STATICS OF THE RIGID BODIES Hibbelers.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Renaissance Architecture: A Journey from Faith to Humanism
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Pharma ospi slides which help in ospi learning

Binaty Arithmetic and Binary coding schemes

  • 1. Dr. Anita Goel Assoc. Prof. (Computer Sci.) Dyal Singh College, University of Delhi
  • 2.  Introduction  Binary Arithmetic  Signed and Unsigned Numbers  Binary Data Representation  Binary Coding Schemes 2
  • 3.  Uses digits 0-9  Digits combined to form numbers like 104, 4561  Decimal arithmetic operations  Addition, subtraction, multiplication, division  For e.g., a chocolate costs Rs. 5/-. Total cost of 2 chocolates will be Rs. 10/- i.e. (5*2) or (5+5) 3
  • 4.  Used in computer systems  Uses digits 0’s and 1’s only  Digits combined to form numbers like 1001, 11000110  A digit 0 or 1 is called a bit (binary digit)  1001 is a 4-bit number.  11000110 is an 8-bit number 4
  • 5.  All data is represented internally in a computer by a combination of bits.  Each symbol is represented by a combination of bits. 5
  • 6.  Arithmetic operations performed on binary numbers is called binary arithmetic.  addition, subtraction, multiplication, division.  Computer systems actually perform only Binary Addition and Binary Subtraction.  Binary Multiplication and Division is performed using some simple operations 6
  • 7.  Involves addition of two or more binary numbers.  Uses Binary addition rules 7
  • 8. 8 Input 1 Input 2 Sum Carry 0 0 0 No carry 0 1 1 No carry 1 0 1 No carry 1 1 0 1
  • 9. 9 Input 1 Input 2 Input 3 Sum Carry 1 1 1 1 1
  • 10. 1. Start by adding bits in unit column (rightmost column) 2. Result of adding bits of a column is a sum with or without a carry. 3. Write sum in result of that column. 4. If carry is present, carry is carried-over to addition of the adjacent left column. 5. Then repeat the above steps, for each of the columns, i.e., tens column, hundreds column and so on. 10
  • 11. Example 1. Add 10 and 01. Verify answer with the help of decimal addition. 11 Binary Addition 1 0 + 0 1 11 Decimal Addition 2 1+ 3 112 = 310
  • 12. Example 2. Add 01 and 11. Verify answer with the help of decimal addition. 12 Binary Addition 0 1 + 1 1 00 Decimal Addition 1 3+ 4 1 1 1002 = 410
  • 13. Example 3. Add 11 and 11. Verify answer with the help of decimal addition. 13 Binary Addition 1 1 + 1 1 01 Decimal Addition 3 3+ 6 1 1 1102 = 610
  • 14. Example 4. Add 1101 and 1111. Verify answer with the help of decimal addition. 14 Binary Addition 1 1 0 1 + 1 1 1 1 01 Decimal Addition 1 3 1 5+ 2 8 1 1 11 01 111002 = 2810
  • 15. Example 5. Add 10111, 11100 and 11. Verify answer with the help of decimal addition. 15 Binary Addition 1 0 1 1 1 1 1 1 0 0 + 1 1 01 Decimal Addition 2 3 2 8 3+ 5 4 1 0 11 11 1 1 1101102 = 5410
  • 16.  Uses Binary subtraction rules 16 Input 1 Input 2 Difference Borrow 0 0 0 No borrow 0 1 1 1 1 0 1 No borrow 1 1 0 No borrow Binary Subtraction Rules
  • 17. 1. Start by subtracting bit in lower row from bit in upper row, in unit column. 2. If bit in upper row is less than the bit in lower row, borrow 1 from upper row of adjacent left column. 3. Result of subtracting two bits is the difference. 4. Write difference in result of that column. 5. Then repeat the above steps, for each of the columns, i.e., tens column, hundreds column and so on. 17
  • 18. Example 1. Subtract 01 from 11. Verify answer with the help of decimal subtraction. 18 Binary Subtraction 1 1 - 0 1 01 Decimal Subtraction 3 1- 2 102 = 210
  • 19. Example 2. Subtract 01 from 10. Verify answer with the help of decimal subtraction. 19 Binary Subtraction 1 0 - 0 1 10 Decimal Subtraction 2 1- 1 10 012 = 110 0
  • 20. Example 3. Subtract 0111 from 1110. Verify answer with the help of decimal subtraction. 20 Binary Subtraction 1 1 1 0 - 0 1 1 1 10 Decimal Subtraction 1 4 7- 7 10 10 11 10 01112 = 710 000
  • 21. Example 4 Subtract 10010 from 10101. Verify answer with the help of decimal subtraction. 21 Binary Subtraction 1 0 1 0 1 - 1 0 0 1 0 10 Decimal Subtraction 2 1 1 8- 3 10 100 000112 = 310 0
  • 22. Example 5. Subtract 101111 from 110001. Verify answer with the help of decimal subtraction. 22 Binary Subtraction 1 1 0 0 0 1 - 1 0 1 1 1 1 10 Decimal Subtraction 4 9 4 7- 2 101010 00 0 0 11 0000102 = 210 0
  • 23.  A binary number may be positive or negative.  Generally, symbols “+” and “-” represent positive and negative numbers, respectively.  In computer, sign of a binary number has to be represented using 0 and 1. 23
  • 24.  n-bit signed binary number consists of two parts  Sign bit, and Magnitude.  Left most bit is called Most Significant Bit (MSB).  MSB is the sign bit.  Remaining n-1 bits denote magnitude of number. 24 MSB Sign bit Magnitude 1 bit n-1 bits
  • 25.  Sign bit is 0 for a positive number and 1 for a negative number.  0 1100011 is a positive number. Sign bit is 0, and,  1 1001011 is a negative number. Sign bit is 1. 25 0 1100011 MSB 1 1001011 MSB Positive Number Negative Number
  • 26.  Data range for 8-bit signed number is:  -128 to +127 (-27 to +27-1).  Leftmost bit is sign bit.  In n-bit unsigned binary number, magnitude of number n is stored in n bits.  Data range for 8-bit unsigned number is:  0 to 255 (28= 256). 26
  • 27.  Used in computer for simplification of subtraction operation.  Two types of complements  1’s complement, and  2’ s complement. 27
  • 28.  Change bits 1 to 0 and bits 0 to 1.  Some examples Binary Numbers 1’s Complement 28 1 1 0 0 0 1 1 0 1 1 0 1 0 0 0 0 1 0 0 0 0 1 1 0 1 1 1 1
  • 29.  Add 1 to the 1’s complement of the binary number.  Some Examples: Binary Numbers 1’s Complement 2’s Complement 29 0 1 0 0 1 0 1 0 0 1 0 0 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0
  • 30.  Binary number can also have a binary point, in addition to sign.  Binary point used for representing fractions, integers and integer-fraction numbers.  Registers are high-speed storage areas in CPU of computer. All data is brought into a register before it gets processed. 30
  • 31.  Two ways of representing position of binary point in a register  Fixed Point Number Representation, and  Floating Point Number Representation. 31
  • 32.  Assumes binary point is fixed at one position.  Represents +ve integer binary signed number as-  Sign bit is 0. Magnitude is a positive binary number.  Represents -ve integer binary signed number as-  Sign bit is 1  Magnitude is represented in any one of three ways-  Signed Magnitude representation  Signed 1’s complement representation  Signed 2’s complement representation 32
  • 33.  Signed Magnitude representation  Magnitude is positive binary number itself.  Signed 1’s complement representation  Magnitude is 1’s complement of positive binary number.  Signed 2’s complement representation  Magnitude is 2’s complement of positive binary number. 33
  • 34. +18 0 0 0 1 0 0 1 0 Sign bit is 0 Binary equivalent of +18 -18 Signed magnitude representation 1 0 0 1 0 0 1 0 Sign bit is 1 Binary equivalent of +18 Signed 1’s complement representation 1 1 1 0 1 1 0 1 Sign bit is 1 1’s complement of +18 Signed 2’s complement representation 1 1 1 0 1 1 1 0 Sign bit is 1 2’s complement of +18 Fixed Point Representation of Signed Number 18 34
  • 35.  Signed magnitude and signed 1’s complement representation are rarely used in computer arithmetic.  Signed 2’s complement representation is used to represent negative numbers. 35
  • 36.  Represent positive number in binary form.  For e.g., +5 is 0000 0101, +10 is 0000 1010  Represent negative number in 2’s complement form.  For e.g., -5 is 111 1 1011, -10 is 1111 0110  Add bits of the two signed binary numbers.  Ignore any carry out from sign bit position. 36
  • 37.  Negative output is automatically in 2’s complement form.  Get decimal equivalent of negative output number  Find its 2’s complement, and  Attach a negative sign to the obtained result. 37
  • 38. Example 1. Add binary +5 and +10. Verify answer with the help of decimal addition. 38 Binary Addition 0 0 0 0 0 1 0 1 + 0 0 0 0 1 0 1 0 0 100 0 Decimal Addition 5 1 0+ 1 5 + +1 11 0000 11112 = +1510
  • 39. Example 2. Add binary -5 and +10. Verify answer with the help of decimal addition. 39 Binary Addition 1 1 1 1 1 0 1 1 + 0 0 0 0 1 0 1 0 0 000 0 Decimal Addition 5 1 0+ 5 - +0 11 111111 0000 01012 = +510
  • 40. Example 3. Add binary +5 and -10. Verify answer with the help of decimal addition. 40 Binary Addition 0 0 0 0 0 1 0 1 + 1 1 1 1 0 1 1 0 1 111 1 Decimal Addition 5 1 0- 5 + -1 10 1 1111 10112 = -510
  • 41. Example 4. Add binary -5 and -10. Verify answer with the help of decimal addition. 41 Binary Addition 1 1 1 1 1 0 1 1 + 1 1 1 1 0 1 1 0 1 011 1 Decimal Addition 5 1 0- 1 5 - -0 10 111 1 11 1 1111 00012 = -1510
  • 42.  Changed to addition of two signed numbers.  Sign of second number is changed before performing the addition operation. 42
  • 43. (+A) – (+B) = (+A) + (-B) (+A) – (-B) = (+A) + (+B) (-A) – (-B) = (-A) + (+B) (-A) – (+B) = (-A) + (-B) 43
  • 44.  Uses two registers  1st register stores number without binary point.  2nd register stores a number that indicates position of binary point in first register.  Consists of two parts:  Mantissa, and Exponent.  Mantissa is a signed fixed point number.  Exponent shows position of binary point in mantissa. 44
  • 45. 45 Represent binary number +11001.11 with 8-bit mantissa and 6-bit exponent Floating point number is: Mantissa x 2exponent + (.1100111) x 2+5. Mantissa Exponent number is positive binary equivalent of +5 0 11 0 0 111 0 0 0 1 0 1 11 0 0 1 . 11 . 11 0 0 111 x 2 5
  • 46.  Data - alphabetic, numeric, alphanumeric, sound, video.  Data represented as combination of bits in computer.  Bits are grouped in a fixed size.  Code is made by combining bits of definite size. 46
  • 47.  Represents symbols in a standard code.  Combination of bits represents a unique symbol.  Standard code enables programmers to use same combination of bits to represent a symbol in data. 47
  • 48.  Commonly used binary coding schemes:  ASCII,  EBCDIC, and  Unicode 48
  • 49.  EBCDIC stands for Extended Binary Coded Decimal Interchange Code  8-bit code. 4 bits for zone; 4 bits for digit.  Allows 28 = 256 combinations.  Represents 256 unique symbols.  Used mainly in mainframe computers. 49
  • 50.  ASCII stands for American Standard Code for Information Interchange  Two types of ASCII codes  ASCII-7 and  ASCII-8. 50
  • 51.  Standard ASCII code.  7-bit code. 3 bits for zone; 4 bits for digits.  Allows 27 = 128 combinations.  Represents 128 unique symbols.  ASCII-7 modified by IBM to ASCII-8. 51
  • 52.  Extended version of ASCII-7.  8-bit code. 4 bits for zone; 4 bits for digit.  Allows 28 = 256 combinations.  Represents 256 unique symbols.  Widely used to represent data in computer. 52
  • 53.  ASCII-8 code represents 256 symbols.  0-31 for control characters.  Non-printable. Carriage Return (CR), Bell (BEL).  48-57 for numeric 0-9.  65-90 for uppercase letters A-Z.  97-122 for lowercase letters a-z.  128-255 are extended ASCII codes. 53
  • 54.  Universal character encoding standard  Represents text, symbols, characters in multi- lingual environments.  Uniquely represent a symbol in languages like Chinese, Japanese etc.  Represents mathematical and scientific symbols.  32 bit code.  Allows 232 = approx. 4 billion combinations. 54
  • 55.  Compatible with ASCII-8 codes.  Unicode’s first 256 codes identical to ASCII- 8 codes.  Implemented by character encodings.  UTF-8 : A character encoding  Most commonly used encoding scheme.  Uses 8-32 bits per code. 55
  • 56. Unicode character encoding in MS-Word 2007 56