SlideShare a Scribd company logo
1 of 27
NUMBER SYSTEMS
NUMBERS ARE EXPRESSED IN DIFFERENT WAYS 
一二三 
Chinese 
l ll lll 
Roman 
1 2 3 
Hindu-Arabic
OUR NUMBER SYSTEM – DECIMAL OR DENARY 
SYSTEM 
Adopted from the Hindu-Arabic numeral system 
We use ten digits: 
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
BINARY NUMBER SYSTEM 
Number system based on 2 
0 and 1 are used 
0 = off 
1 = on 
As only 2 numbers are used, calculations can be performed quickly
DENARY NUMBER SYSTEM 
We learnt numbers by dividing into columns 
Each heading is multiplied by 10 
100x10 10x10 1x10 
Thousands Hundreds Tens Units 
2 0 1 4 
1 9 8 5 
0 5 2 3 
0 0 3 1 
0 0 0 8
BINARY SYSTEM 
Each heading is multiplied by 2 
16x2 8x2 4x2 2x2 1x2 64x2 32x2 
128 64 32 16 8 4 2 1 
1 0 0 0 0 0 0 1 
So, we have 
One 128 
None of the rest 
And one 1 
Therefore 128 + 1 = 129
BINARY SYSTEM 
Even if the number starts with 0, we usually include it: 
128 64 32 16 8 4 2 1 
0 0 0 0 0 0 0 1 
This has none of the numbers except one 1 
So the answer is 1 
But we express 1 in binary as: 00000001
NEGATIVE NUMBERS 
So far we have only looked at positive numbers. 
In 8-bit binary, there is nowhere to put a negative sign - 
128 64 32 16 8 4 2 1 
1 0 0 0 0 0 0 1
SIGN / MAGNITUDE REPRESENTATION 
So we replace the first column (128) and make it stand for +/- 
+/- 64 32 16 8 4 2 1 
We use a 1 to stand for the negative sign(-), and 0 if it’s a positive number (+) 
So -75 is 
+/- 64 32 16 8 4 2 1 
1 1 0 0 1 0 1 1
SIGN / MAGNITUDE REPRESENTATION 
Imagine a line that divides the sign and the magnitude 
+/- 64 32 16 8 4 2 1 
SIGN 
+/- 
MAGNITUDE 
Size of the 
number
POSITIVE 
+/- 64 32 16 8 4 2 1 
0 1 0 0 0 0 0 1 
0 0 1 0 0 1 1 1 
0 0 0 1 1 1 0 1 
NEGATIVE 
+/- 64 32 16 8 4 2 1 
1 1 0 0 0 0 0 1 
1 0 1 0 0 1 1 1 
1 0 0 1 1 1 0 1 
Denary 
65 
39 
29 
Denary 
-65 
-39 
-29
PROBLEMS 
+/- 64 32 16 8 4 2 1 
1 1 0 0 1 0 1 1 
Previously, we could use all columns and make a number up to 255. 
Now, the biggest number we can make is halved, because we have replaced the 128 
column with +/-. 
Second, the binary number contains values AND ALSO a sign. 
This makes it difficult to do arithmetic. 
E.g. We can’t add a – sign to 1
2s Complement 
2s complement allows us to represent negative numbers without having to 
worry about using a sign instead of a number 
In 2s complement we use -128 instead of -, which looks like this: 
-128 64 32 16 8 4 2 1
2s Complement 
OK, se we want to represent -75 in 2s complement binary 
As it’s a negative number, we need a 1 in the -128 column 
-128 64 32 16 8 4 2 1 
1
2s Complement 
BUT, -128 is 53 too many (-128 – (-75) = -53) 
This means we need to add 53 to get back to -75 
So, 53 is 0*64 
-128 64 32 16 8 4 2 1 
1 0
2s Complement 
BUT, -128 is 53 too many (-128 – (-75) = -53) 
This means we need to add 53 to get back to -75 
So, 53 is 0*64, 1*32 
-128 64 32 16 8 4 2 1 
1 0 1
2s Complement 
BUT, -128 is 53 too many (-128 – (-75) = -53) 
This means we need to add 53 to get back to -75 
So, 53 is 0*64, 1*32, 1*16, 
-128 64 32 16 8 4 2 1 
1 0 1 1
2s Complement 
BUT, -128 is 53 too many (-128 – (-75) = -53) 
This means we need to add 53 to get back to -75 
So, 53 is 0*64, 1*32, 1*16, 0*8, 
-128 64 32 16 8 4 2 1 
1 0 1 1 0
2s Complement 
BUT, -128 is 53 too many (-128 – (-75) = -53) 
This means we need to add 53 to get back to -75 
So, 53 is 0*64, 1*32, 1*16, 0*8, 1*4, 
-128 64 32 16 8 4 2 1 
1 0 1 1 0 1
2s Complement 
BUT, -128 is 53 too many (-128 – (-75) = -53) 
This means we need to add 53 to get back to -75 
So, 53 is 0*64, 1*32, 1*16, 0*8, 1*4, 0*2 
-128 64 32 16 8 4 2 1 
1 0 1 1 0 1 0
2s Complement 
BUT, -128 is 53 too many (-128 – (-75) = -53) 
This means we need to add 53 to get back to -75 
So, 53 is 0*64, 1*32, 1*16, 0*8, 1*4, 0*2, 1*1 
-128 64 32 16 8 4 2 1 
1 0 1 1 0 1 0 1
BINARY ADDITION 
Adding two binary numbers isn’t really that scary – it’s just the same as adding 
denary numbers! 
You need to work from right to left, just the same 
Remember that there’s only 1 and 0, adding two 1s means you need to carry 1 
to the next column
DEMO 
0 0 0 1 0 0 1 0 
+ 0 0 0 1 0 1 0 0 
0 
0+0=0 
1 
1+0=1 
0 
1 
1+0=1 
0+0=0 
0 
1 
0+0=0 0 0 
1 
1+1=0 
(carry 1) 
0+0+1=1 
(1 was carried 
over)
BINARY SUBTRACTION 
Subtraction can cause problems, especially when subtracting a number from a smaller number. 
75 – 14 is the same as 75 + (-14) 
We use 2s complement to convert the numbers 
-128 64 32 16 8 4 2 1 
1 0 1 1 0 1 0 1
OCTAL 
Base of 8 
We use 8 digits: 
0,1,2,3,4,5,6,7 
Headings become: 
512 64 8 1 
0 1 1 3 
So, above we have 
64+8+(3*1) = 75
BINARY CODED DECIMAL (BCD) 
Each denary digit is represented separately 
Four binary digits are used (nibbles): 
Binary Denary 
8 4 2 1 
0 1 1 1 = 4+2+1 = 7 
0 1 0 1 = 4+1 = 5 
1 0 0 1 = 8+1 = 9
BINARY CODED DECIMAL (BCD) 
Each denary digit is represented separately 
Four binary digits are used: 
Denary Binary 
8 4 2 1 
7 = 0 1 1 1 
5 = 0 1 0 1 
So, 75 in BCD is 01110101

More Related Content

What's hot

Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
gavhays
 
Data types
Data typesData types
Data types
gavhays
 
Representation Of Data
Representation Of DataRepresentation Of Data
Representation Of Data
gavhays
 

What's hot (20)

Chapter 7 rohith
Chapter 7 rohithChapter 7 rohith
Chapter 7 rohith
 
Complements
ComplementsComplements
Complements
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
EC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's ComplementEC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's Complement
 
Two’s complement
Two’s complementTwo’s complement
Two’s complement
 
Binary true ppt
Binary true pptBinary true ppt
Binary true ppt
 
1s and 2s complement
1s and 2s complement1s and 2s complement
1s and 2s complement
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complements
 
Binary coded decimal r004
Binary coded decimal   r004Binary coded decimal   r004
Binary coded decimal r004
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
1's and 2's complement
1's and 2's complement 1's and 2's complement
1's and 2's complement
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
Data types
Data typesData types
Data types
 
Number systems ppt
Number systems pptNumber systems ppt
Number systems ppt
 
Representation Of Data
Representation Of DataRepresentation Of Data
Representation Of Data
 
1sand2scomplement r004
1sand2scomplement  r0041sand2scomplement  r004
1sand2scomplement r004
 
Binary Codes and Number System
Binary Codes and Number SystemBinary Codes and Number System
Binary Codes and Number System
 
CBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,NormalizationCBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,Normalization
 
Number system
Number systemNumber system
Number system
 
Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic
 

Viewers also liked

Microprocessor based software developnent
Microprocessor based software developnentMicroprocessor based software developnent
Microprocessor based software developnent
Sandeep Kamath
 
Strategies for Distributed Data Storage
Strategies for Distributed Data StorageStrategies for Distributed Data Storage
Strategies for Distributed Data Storage
kakugawa
 
Accessing I/O Devices
Accessing I/O DevicesAccessing I/O Devices
Accessing I/O Devices
Slideshare
 
Core 2 Duo Processor
Core 2 Duo ProcessorCore 2 Duo Processor
Core 2 Duo Processor
Kashif Latif
 
MICROPROCESSOR 8085 WITH PROGRAMS
MICROPROCESSOR 8085 WITH PROGRAMSMICROPROCESSOR 8085 WITH PROGRAMS
MICROPROCESSOR 8085 WITH PROGRAMS
Sabin Gautam
 

Viewers also liked (20)

Seven Segment Decoders
Seven Segment DecodersSeven Segment Decoders
Seven Segment Decoders
 
Counters
CountersCounters
Counters
 
8085 Interfacing with I/O Devices or Memory
8085 Interfacing with I/O Devices or Memory8085 Interfacing with I/O Devices or Memory
8085 Interfacing with I/O Devices or Memory
 
Microprocessor based software developnent
Microprocessor based software developnentMicroprocessor based software developnent
Microprocessor based software developnent
 
BCD ADDER
BCD ADDER BCD ADDER
BCD ADDER
 
Strategies for Distributed Data Storage
Strategies for Distributed Data StorageStrategies for Distributed Data Storage
Strategies for Distributed Data Storage
 
Input output interface
Input output interfaceInput output interface
Input output interface
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1
 
Accessing I/O Devices
Accessing I/O DevicesAccessing I/O Devices
Accessing I/O Devices
 
Microprocessor applications
Microprocessor applicationsMicroprocessor applications
Microprocessor applications
 
Programming with 8085
Programming with 8085Programming with 8085
Programming with 8085
 
system software and application software, compiler, interpreter & assembler
system software  and application software, compiler, interpreter & assemblersystem software  and application software, compiler, interpreter & assembler
system software and application software, compiler, interpreter & assembler
 
Core 2 Duo Processor
Core 2 Duo ProcessorCore 2 Duo Processor
Core 2 Duo Processor
 
MICROPROCESSOR 8085 WITH PROGRAMS
MICROPROCESSOR 8085 WITH PROGRAMSMICROPROCESSOR 8085 WITH PROGRAMS
MICROPROCESSOR 8085 WITH PROGRAMS
 
I3,i5,i7 ppt
I3,i5,i7 pptI3,i5,i7 ppt
I3,i5,i7 ppt
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
8085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing18085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing1
 
Interrupts
InterruptsInterrupts
Interrupts
 
Microprocessor ppt
Microprocessor pptMicroprocessor ppt
Microprocessor ppt
 
Applications of 8051 microcontrollers
Applications of 8051 microcontrollersApplications of 8051 microcontrollers
Applications of 8051 microcontrollers
 

Similar to Number systems - binary, BCD, 2s comp

ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
ssuser52a19e
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and Hexadecimal
UtkirjonUbaydullaev1
 

Similar to Number systems - binary, BCD, 2s comp (20)

Notes unit 2
Notes   unit 2Notes   unit 2
Notes unit 2
 
09 binary number systems
09   binary number systems09   binary number systems
09 binary number systems
 
Introduction to binary
Introduction to binaryIntroduction to binary
Introduction to binary
 
Data types - things you have to know!
Data types - things you have to know!Data types - things you have to know!
Data types - things you have to know!
 
Vedic maths 2
Vedic maths 2Vedic maths 2
Vedic maths 2
 
NUMBER BASE SYSTEM.pptx
NUMBER BASE SYSTEM.pptxNUMBER BASE SYSTEM.pptx
NUMBER BASE SYSTEM.pptx
 
Quick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representationQuick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representation
 
Decimal to Binary Conversion
Decimal to Binary ConversionDecimal to Binary Conversion
Decimal to Binary Conversion
 
Unit 3 Data Representation
Unit 3 Data RepresentationUnit 3 Data Representation
Unit 3 Data Representation
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
Representation of Negative Numbers
Representation of Negative NumbersRepresentation of Negative Numbers
Representation of Negative Numbers
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
 
What is binary and why do we use it?
What is binary and why do we use it?What is binary and why do we use it?
What is binary and why do we use it?
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
binary-numbers.ppt
binary-numbers.pptbinary-numbers.ppt
binary-numbers.ppt
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and Hexadecimal
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 

Recently uploaded

Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

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
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
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
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.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
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 

Number systems - binary, BCD, 2s comp

  • 2. NUMBERS ARE EXPRESSED IN DIFFERENT WAYS 一二三 Chinese l ll lll Roman 1 2 3 Hindu-Arabic
  • 3. OUR NUMBER SYSTEM – DECIMAL OR DENARY SYSTEM Adopted from the Hindu-Arabic numeral system We use ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • 4. BINARY NUMBER SYSTEM Number system based on 2 0 and 1 are used 0 = off 1 = on As only 2 numbers are used, calculations can be performed quickly
  • 5. DENARY NUMBER SYSTEM We learnt numbers by dividing into columns Each heading is multiplied by 10 100x10 10x10 1x10 Thousands Hundreds Tens Units 2 0 1 4 1 9 8 5 0 5 2 3 0 0 3 1 0 0 0 8
  • 6. BINARY SYSTEM Each heading is multiplied by 2 16x2 8x2 4x2 2x2 1x2 64x2 32x2 128 64 32 16 8 4 2 1 1 0 0 0 0 0 0 1 So, we have One 128 None of the rest And one 1 Therefore 128 + 1 = 129
  • 7. BINARY SYSTEM Even if the number starts with 0, we usually include it: 128 64 32 16 8 4 2 1 0 0 0 0 0 0 0 1 This has none of the numbers except one 1 So the answer is 1 But we express 1 in binary as: 00000001
  • 8. NEGATIVE NUMBERS So far we have only looked at positive numbers. In 8-bit binary, there is nowhere to put a negative sign - 128 64 32 16 8 4 2 1 1 0 0 0 0 0 0 1
  • 9. SIGN / MAGNITUDE REPRESENTATION So we replace the first column (128) and make it stand for +/- +/- 64 32 16 8 4 2 1 We use a 1 to stand for the negative sign(-), and 0 if it’s a positive number (+) So -75 is +/- 64 32 16 8 4 2 1 1 1 0 0 1 0 1 1
  • 10. SIGN / MAGNITUDE REPRESENTATION Imagine a line that divides the sign and the magnitude +/- 64 32 16 8 4 2 1 SIGN +/- MAGNITUDE Size of the number
  • 11. POSITIVE +/- 64 32 16 8 4 2 1 0 1 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 0 1 NEGATIVE +/- 64 32 16 8 4 2 1 1 1 0 0 0 0 0 1 1 0 1 0 0 1 1 1 1 0 0 1 1 1 0 1 Denary 65 39 29 Denary -65 -39 -29
  • 12. PROBLEMS +/- 64 32 16 8 4 2 1 1 1 0 0 1 0 1 1 Previously, we could use all columns and make a number up to 255. Now, the biggest number we can make is halved, because we have replaced the 128 column with +/-. Second, the binary number contains values AND ALSO a sign. This makes it difficult to do arithmetic. E.g. We can’t add a – sign to 1
  • 13. 2s Complement 2s complement allows us to represent negative numbers without having to worry about using a sign instead of a number In 2s complement we use -128 instead of -, which looks like this: -128 64 32 16 8 4 2 1
  • 14. 2s Complement OK, se we want to represent -75 in 2s complement binary As it’s a negative number, we need a 1 in the -128 column -128 64 32 16 8 4 2 1 1
  • 15. 2s Complement BUT, -128 is 53 too many (-128 – (-75) = -53) This means we need to add 53 to get back to -75 So, 53 is 0*64 -128 64 32 16 8 4 2 1 1 0
  • 16. 2s Complement BUT, -128 is 53 too many (-128 – (-75) = -53) This means we need to add 53 to get back to -75 So, 53 is 0*64, 1*32 -128 64 32 16 8 4 2 1 1 0 1
  • 17. 2s Complement BUT, -128 is 53 too many (-128 – (-75) = -53) This means we need to add 53 to get back to -75 So, 53 is 0*64, 1*32, 1*16, -128 64 32 16 8 4 2 1 1 0 1 1
  • 18. 2s Complement BUT, -128 is 53 too many (-128 – (-75) = -53) This means we need to add 53 to get back to -75 So, 53 is 0*64, 1*32, 1*16, 0*8, -128 64 32 16 8 4 2 1 1 0 1 1 0
  • 19. 2s Complement BUT, -128 is 53 too many (-128 – (-75) = -53) This means we need to add 53 to get back to -75 So, 53 is 0*64, 1*32, 1*16, 0*8, 1*4, -128 64 32 16 8 4 2 1 1 0 1 1 0 1
  • 20. 2s Complement BUT, -128 is 53 too many (-128 – (-75) = -53) This means we need to add 53 to get back to -75 So, 53 is 0*64, 1*32, 1*16, 0*8, 1*4, 0*2 -128 64 32 16 8 4 2 1 1 0 1 1 0 1 0
  • 21. 2s Complement BUT, -128 is 53 too many (-128 – (-75) = -53) This means we need to add 53 to get back to -75 So, 53 is 0*64, 1*32, 1*16, 0*8, 1*4, 0*2, 1*1 -128 64 32 16 8 4 2 1 1 0 1 1 0 1 0 1
  • 22. BINARY ADDITION Adding two binary numbers isn’t really that scary – it’s just the same as adding denary numbers! You need to work from right to left, just the same Remember that there’s only 1 and 0, adding two 1s means you need to carry 1 to the next column
  • 23. DEMO 0 0 0 1 0 0 1 0 + 0 0 0 1 0 1 0 0 0 0+0=0 1 1+0=1 0 1 1+0=1 0+0=0 0 1 0+0=0 0 0 1 1+1=0 (carry 1) 0+0+1=1 (1 was carried over)
  • 24. BINARY SUBTRACTION Subtraction can cause problems, especially when subtracting a number from a smaller number. 75 – 14 is the same as 75 + (-14) We use 2s complement to convert the numbers -128 64 32 16 8 4 2 1 1 0 1 1 0 1 0 1
  • 25. OCTAL Base of 8 We use 8 digits: 0,1,2,3,4,5,6,7 Headings become: 512 64 8 1 0 1 1 3 So, above we have 64+8+(3*1) = 75
  • 26. BINARY CODED DECIMAL (BCD) Each denary digit is represented separately Four binary digits are used (nibbles): Binary Denary 8 4 2 1 0 1 1 1 = 4+2+1 = 7 0 1 0 1 = 4+1 = 5 1 0 0 1 = 8+1 = 9
  • 27. BINARY CODED DECIMAL (BCD) Each denary digit is represented separately Four binary digits are used: Denary Binary 8 4 2 1 7 = 0 1 1 1 5 = 0 1 0 1 So, 75 in BCD is 01110101