SlideShare a Scribd company logo
Working with
binary numbers
DECIMAL TO BINARY CONVERSION
600 / 2 = 300 r 0 [least significant bit - lsb]
300 / 2 = 150 r 0
150 / 2 = 75 r 0
75 / 2 = 37 r 1
37 / 2 = 18 r 1
18 / 2 = 9 r 0
9 / 2 = 4 r 1
4 / 2 = 2 r 0
2 / 2 = 2 r 0
1 / 2 = 0 r 1 [most significant bit - msb]
Decimal to Hexadecimal Conversion
5789 ÷ 16 = 361 r 13 or D LSB
361 ÷ 16 = 22 r 9 or 9
22 ÷ 16 = 1 r 6 or 6
1 ÷ 16 = 0 r 1 or 1 MSB
5789 in decimal = 169D in hexadecimal.
Negative numbers
On paper, a negative number is represented by a dash – in front of
the number.
A computer can only ADD positive numbers
A computer can only work with 0's and 1's.
The solution??
Method of complements
http://en.wikipedia.org/wiki/Method_of_complements
Before digital computers, mechanical calculators used the
9's complement numbering method, as it could only
subtract by adding together positive numbers.
See :
http://en.wikipedia.org/wiki/Method_of_complements#Decimal_example
for more information.
The binary 'sign' bit
An 8-bit binary number (data type 'int' in C, 'byte' in Java) can be
used to represent negative numbers by 'hijacking' the MSB for use
as a 'sign bit'.
With 8 bits you can represent numbers which range from:
(Sign bit)+ ----->0] 0 0 0 0 0 0 0 (+0 in decimal)
(Sign bit)- ----->1] 0 0 0 0 0 0 0 (-0 in decimal)
(Sign bit)+ ----->0] 1 1 1 1 1 1 1 (+127 in decimal)
(Sign bit)- ----->1] 1 1 1 1 1 1 1 (-127 in decimal)
The first number represents whether the number is positive or
negative.
0 = + 1 = -
For example::
00000111 represents 7 in decimal
10000111 represents -7 in decimal
So:
00000000 to 01111111 represents 0 to 127
and
10000000 to 11111111 represents 0 to -127
Notice that there are two representations for zero
00000000 and 10000000
This is a problem.
Complementary numbers
Complementary numbers are found by counting backwards from the
highest number available. For an 8-bit number this is:
11111111
Counting backwards we get::
11111111 = -0
11111110 = -1
11111101 = -2
11111100 = -3
11111011 = -4
This is known as the 1's complement of a positive number.
So a complementary number is an inverted 'normal' number, where
a negative number is made by 'bitwise inverting' the positive
number.
00000000 = +0
11111111 = -0 (silly)
00000001 = +1
11111110 = -1
00000010 = +2
11111101 = -2
Notice that 00000000 and 11111111 both represent zero, which
is a 'waste' of a binary number.
To make better use of the complementary number range, it would
make better sense to let 00000000 represent zero, and 11111111
to represent -1 instead of -0, which is silly.
So take the 1's complement and add 1 to it. Now it is 11111111 that
represents -1 rather than 11111110. This is shown here:
11111110 + 00000001 = 11111111 = (or represents) -1
11111101 + 00000001 = 11111110 = (or represents) -2
11111100 + 00000001 = 11111101 = (or represents) -3
11111011 + 00000001 = 11111100 = (or represents) -4
11111010 + 00000001 = 11111011 = (or represents) -5
11111001 + 00000001 = 11111010 = (or represents) -6
11111000 + 00000001 = 11111001 = (or represents) -7
1's complement + 1 = 2's complement
So 1's complement + 1 is known as the 'true' or 2's complement.
So.
To find a 2's complement representation of (say) the number -7
start with +7, ie.
00000111
Then invert (NOT) every bit to get the 1's complement.
11111000
Then add 1 to the number to get the 2's complement.
11111000 + 1 = 11111001
The MSB is a 1 so the number is negative, and this number now
REPRESENTS -7 for calculation purposes.
Subtraction in Binary
Computers can only move binary information, and add it together.
They cannot directly perform multiplication, subtraction or division.
Subtraction of two binary numbers can only be done in a computer
by adding together the normal representation of a positive number
to the 2's complement of the negative number.
For example::
45 - 20 = 25
This can be expressed as:
+45 + (-20) = +25
+45 = 0010 1101 normal representation
+20 = 0001 0100 normal representation
-20 = 1110 1011 1's complement
+ 0000 0001 add 1 to give:
-20 = 1110 1100 2's complement
Note the process to get the 2's complement
Now add:
+45 = 0010 1101 normal representation
-20 = 1110 1100 2's complement
= (1)0001 1001
= 25 in decimal
The "overflow" 9th bit above is ignored.

More Related Content

What's hot

Lecture 06 computer arithmatic
Lecture 06 computer arithmaticLecture 06 computer arithmatic
Lecture 06 computer arithmatic
Obaidur Rahman
 
Digital fundamendals r001a
Digital fundamendals r001aDigital fundamendals r001a
Digital fundamendals r001a
arunachalamr16
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rules
student
 
Code conversion r006
Code conversion r006Code conversion r006
Code conversion r006
arunachalamr16
 
Digital logic mohammed salim ch2
Digital logic mohammed salim ch2Digital logic mohammed salim ch2
Digital logic mohammed salim ch2
Asst Lect Mohammed Salim
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complements
arunachalamr16
 
1sand2scomplement r004
1sand2scomplement  r0041sand2scomplement  r004
1sand2scomplement r004
arunachalamr16
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
Meenakshi Paul
 
Representation Of Data
Representation Of DataRepresentation Of Data
Representation Of Datagavhays
 
Binary Codes and Number System
Binary Codes and Number SystemBinary Codes and Number System
Binary Codes and Number System
Debarati Das
 
Number systems r002
Number systems  r002Number systems  r002
Number systems r002
arunachalamr16
 
CBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,NormalizationCBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,Normalization
AmberSinghal1
 
2s complement arithmetic
2s complement arithmetic2s complement arithmetic
2s complement arithmetic
Sanjay Saluth
 
Two’s complement
Two’s complementTwo’s complement
Two’s complement
mayannpolisticoLNU
 
Chapter 7 rohith
Chapter 7 rohithChapter 7 rohith
Chapter 7 rohith
Rohith Shivashankar
 
Complement
ComplementComplement
Complement
Sudheesh S Madhav
 
Decimal to binary number
Decimal to binary numberDecimal to binary number
Decimal to binary numberguestd8696a
 
Codes r005
Codes  r005Codes  r005
Codes r005
arunachalamr16
 

What's hot (20)

Lecture 06 computer arithmatic
Lecture 06 computer arithmaticLecture 06 computer arithmatic
Lecture 06 computer arithmatic
 
Digital fundamendals r001a
Digital fundamendals r001aDigital fundamendals r001a
Digital fundamendals r001a
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rules
 
Code conversion r006
Code conversion r006Code conversion r006
Code conversion r006
 
Digital logic mohammed salim ch2
Digital logic mohammed salim ch2Digital logic mohammed salim ch2
Digital logic mohammed salim ch2
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complements
 
1sand2scomplement r004
1sand2scomplement  r0041sand2scomplement  r004
1sand2scomplement r004
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
Representation Of Data
Representation Of DataRepresentation Of Data
Representation Of Data
 
Binary Codes and Number System
Binary Codes and Number SystemBinary Codes and Number System
Binary Codes and Number System
 
Number systems r002
Number systems  r002Number systems  r002
Number systems r002
 
CBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,NormalizationCBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,Normalization
 
2s complement arithmetic
2s complement arithmetic2s complement arithmetic
2s complement arithmetic
 
Two’s complement
Two’s complementTwo’s complement
Two’s complement
 
Chapter 7 rohith
Chapter 7 rohithChapter 7 rohith
Chapter 7 rohith
 
Floating Point Numbers
Floating Point NumbersFloating Point Numbers
Floating Point Numbers
 
Pp02
Pp02Pp02
Pp02
 
Complement
ComplementComplement
Complement
 
Decimal to binary number
Decimal to binary numberDecimal to binary number
Decimal to binary number
 
Codes r005
Codes  r005Codes  r005
Codes r005
 

Viewers also liked

Math unit7 number system and bases
Math unit7 number system and basesMath unit7 number system and bases
Math unit7 number system and bases
eLearningJa
 
Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic
renatus katundu
 
Math1003 1.10 - Binary to Hex Conversion
Math1003 1.10 - Binary to Hex ConversionMath1003 1.10 - Binary to Hex Conversion
Math1003 1.10 - Binary to Hex Conversiongcmath1003
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
Marlon Jamera
 
Html forms
Html formsHtml forms
Html forms
eShikshak
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
Ravinder Kamboj
 
Practical File Itm
Practical File ItmPractical File Itm
Practical File Itm
RahulPersonality
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTMLDoncho Minkov
 
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
Mohammad Bashartullah
 
HTML practicals
HTML practicals HTML practicals
HTML practicals
Abhishek Sharma
 

Viewers also liked (11)

Math unit7 number system and bases
Math unit7 number system and basesMath unit7 number system and bases
Math unit7 number system and bases
 
Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic
 
Math1003 1.10 - Binary to Hex Conversion
Math1003 1.10 - Binary to Hex ConversionMath1003 1.10 - Binary to Hex Conversion
Math1003 1.10 - Binary to Hex Conversion
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
Html forms
Html formsHtml forms
Html forms
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Practical File Itm
Practical File ItmPractical File Itm
Practical File Itm
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
2. HTML forms
2. HTML forms2. HTML forms
2. HTML forms
 
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
 
HTML practicals
HTML practicals HTML practicals
HTML practicals
 

Similar to Working With Binary Numbers

Decimal to Binary Conversion
Decimal to Binary ConversionDecimal to Binary Conversion
Decimal to Binary Conversion
adil raja
 
unit-2_DL.pdf
unit-2_DL.pdfunit-2_DL.pdf
unit-2_DL.pdf
ashoksahu64
 
Notes unit 2
Notes   unit 2Notes   unit 2
Notes unit 2
KamarajA5
 
Data Representation
Data RepresentationData Representation
Data Representation
Education Front
 
Representation of Negative Numbers
Representation of Negative NumbersRepresentation of Negative Numbers
Representation of Negative Numbers
Forrester High School
 
Data Representation
Data RepresentationData Representation
Data Representation
Education Front
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
MUNAZARAZZAQELEA
 
3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt
RavikumarR77
 
Alu1
Alu1Alu1
Unit 3 Data Representation
Unit 3 Data RepresentationUnit 3 Data Representation
Unit 3 Data Representation
Miss Short
 
ch2.pdf
ch2.pdfch2.pdf
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
Suganthi Vasanth Raj
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
ssuser52a19e
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
RAJKUMARP63
 
binary-numbers.ppt
binary-numbers.pptbinary-numbers.ppt
binary-numbers.ppt
MarlonMagtibay2
 
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
 
Integer Representation
Integer RepresentationInteger Representation
Integer Representationgavhays
 
module 1_class_numbers.pptx
module 1_class_numbers.pptxmodule 1_class_numbers.pptx
module 1_class_numbers.pptx
ssuser2efca7
 

Similar to Working With Binary Numbers (20)

Decimal to Binary Conversion
Decimal to Binary ConversionDecimal to Binary Conversion
Decimal to Binary Conversion
 
unit-2_DL.pdf
unit-2_DL.pdfunit-2_DL.pdf
unit-2_DL.pdf
 
Notes unit 2
Notes   unit 2Notes   unit 2
Notes unit 2
 
Data Representation
Data RepresentationData Representation
Data Representation
 
Representation of Negative Numbers
Representation of Negative NumbersRepresentation of Negative Numbers
Representation of Negative Numbers
 
Data Representation
Data RepresentationData Representation
Data Representation
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt
 
Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1
 
Alu1
Alu1Alu1
Alu1
 
09 Arithmetic
09  Arithmetic09  Arithmetic
09 Arithmetic
 
Unit 3 Data Representation
Unit 3 Data RepresentationUnit 3 Data Representation
Unit 3 Data Representation
 
ch2.pdf
ch2.pdfch2.pdf
ch2.pdf
 
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
 
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
 
Integer Representation
Integer RepresentationInteger Representation
Integer Representation
 
module 1_class_numbers.pptx
module 1_class_numbers.pptxmodule 1_class_numbers.pptx
module 1_class_numbers.pptx
 

More from adil raja

ANNs.pdf
ANNs.pdfANNs.pdf
ANNs.pdf
adil raja
 
A Software Requirements Specification
A Software Requirements SpecificationA Software Requirements Specification
A Software Requirements Specification
adil raja
 
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial VehiclesNUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
adil raja
 
DevOps Demystified
DevOps DemystifiedDevOps Demystified
DevOps Demystified
adil raja
 
On Research (And Development)
On Research (And Development)On Research (And Development)
On Research (And Development)
adil raja
 
Simulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge ResearchSimulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge Research
adil raja
 
The Knock Knock Protocol
The Knock Knock ProtocolThe Knock Knock Protocol
The Knock Knock Protocol
adil raja
 
File Transfer Through Sockets
File Transfer Through SocketsFile Transfer Through Sockets
File Transfer Through Sockets
adil raja
 
Remote Command Execution
Remote Command ExecutionRemote Command Execution
Remote Command Execution
adil raja
 
CMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor PakistanCMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor Pakistan
adil raja
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
adil raja
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
adil raja
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
adil raja
 
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIPReal-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
adil raja
 
VoIP
VoIPVoIP
VoIP
adil raja
 
ULMAN GUI Specifications
ULMAN GUI SpecificationsULMAN GUI Specifications
ULMAN GUI Specifications
adil raja
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
adil raja
 
ULMAN-GUI
ULMAN-GUIULMAN-GUI
ULMAN-GUI
adil raja
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
adil raja
 

More from adil raja (20)

ANNs.pdf
ANNs.pdfANNs.pdf
ANNs.pdf
 
A Software Requirements Specification
A Software Requirements SpecificationA Software Requirements Specification
A Software Requirements Specification
 
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial VehiclesNUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
NUAV - A Testbed for Development of Autonomous Unmanned Aerial Vehicles
 
DevOps Demystified
DevOps DemystifiedDevOps Demystified
DevOps Demystified
 
On Research (And Development)
On Research (And Development)On Research (And Development)
On Research (And Development)
 
Simulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge ResearchSimulators as Drivers of Cutting Edge Research
Simulators as Drivers of Cutting Edge Research
 
The Knock Knock Protocol
The Knock Knock ProtocolThe Knock Knock Protocol
The Knock Knock Protocol
 
File Transfer Through Sockets
File Transfer Through SocketsFile Transfer Through Sockets
File Transfer Through Sockets
 
Remote Command Execution
Remote Command ExecutionRemote Command Execution
Remote Command Execution
 
Thesis
ThesisThesis
Thesis
 
CMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor PakistanCMM Level 3 Assessment of Xavor Pakistan
CMM Level 3 Assessment of Xavor Pakistan
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
 
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
Implementation of a Non-Intrusive Speech Quality Assessment Tool on a Mid-Net...
 
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIPReal-Time Non-Intrusive Speech Quality Estimation for VoIP
Real-Time Non-Intrusive Speech Quality Estimation for VoIP
 
VoIP
VoIPVoIP
VoIP
 
ULMAN GUI Specifications
ULMAN GUI SpecificationsULMAN GUI Specifications
ULMAN GUI Specifications
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
 
ULMAN-GUI
ULMAN-GUIULMAN-GUI
ULMAN-GUI
 
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
Modeling the Effect of Packet Loss on Speech Quality: Genetic Programming Bas...
 

Recently uploaded

How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
Gal Baras
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptxLiving-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
TristanJasperRamos
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
Himani415946
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 
Output determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CCOutput determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CC
ShahulHameed54211
 

Recently uploaded (16)

How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptxLiving-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
Output determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CCOutput determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CC
 

Working With Binary Numbers

  • 2. DECIMAL TO BINARY CONVERSION 600 / 2 = 300 r 0 [least significant bit - lsb] 300 / 2 = 150 r 0 150 / 2 = 75 r 0 75 / 2 = 37 r 1 37 / 2 = 18 r 1 18 / 2 = 9 r 0 9 / 2 = 4 r 1 4 / 2 = 2 r 0 2 / 2 = 2 r 0 1 / 2 = 0 r 1 [most significant bit - msb]
  • 3. Decimal to Hexadecimal Conversion 5789 ÷ 16 = 361 r 13 or D LSB 361 ÷ 16 = 22 r 9 or 9 22 ÷ 16 = 1 r 6 or 6 1 ÷ 16 = 0 r 1 or 1 MSB 5789 in decimal = 169D in hexadecimal.
  • 4. Negative numbers On paper, a negative number is represented by a dash – in front of the number. A computer can only ADD positive numbers A computer can only work with 0's and 1's. The solution?? Method of complements http://en.wikipedia.org/wiki/Method_of_complements
  • 5. Before digital computers, mechanical calculators used the 9's complement numbering method, as it could only subtract by adding together positive numbers. See : http://en.wikipedia.org/wiki/Method_of_complements#Decimal_example for more information.
  • 6. The binary 'sign' bit An 8-bit binary number (data type 'int' in C, 'byte' in Java) can be used to represent negative numbers by 'hijacking' the MSB for use as a 'sign bit'. With 8 bits you can represent numbers which range from: (Sign bit)+ ----->0] 0 0 0 0 0 0 0 (+0 in decimal) (Sign bit)- ----->1] 0 0 0 0 0 0 0 (-0 in decimal) (Sign bit)+ ----->0] 1 1 1 1 1 1 1 (+127 in decimal) (Sign bit)- ----->1] 1 1 1 1 1 1 1 (-127 in decimal) The first number represents whether the number is positive or negative. 0 = + 1 = -
  • 7. For example:: 00000111 represents 7 in decimal 10000111 represents -7 in decimal So: 00000000 to 01111111 represents 0 to 127 and 10000000 to 11111111 represents 0 to -127 Notice that there are two representations for zero 00000000 and 10000000 This is a problem.
  • 8. Complementary numbers Complementary numbers are found by counting backwards from the highest number available. For an 8-bit number this is: 11111111 Counting backwards we get:: 11111111 = -0 11111110 = -1 11111101 = -2 11111100 = -3 11111011 = -4 This is known as the 1's complement of a positive number.
  • 9. So a complementary number is an inverted 'normal' number, where a negative number is made by 'bitwise inverting' the positive number. 00000000 = +0 11111111 = -0 (silly) 00000001 = +1 11111110 = -1 00000010 = +2 11111101 = -2 Notice that 00000000 and 11111111 both represent zero, which is a 'waste' of a binary number.
  • 10. To make better use of the complementary number range, it would make better sense to let 00000000 represent zero, and 11111111 to represent -1 instead of -0, which is silly. So take the 1's complement and add 1 to it. Now it is 11111111 that represents -1 rather than 11111110. This is shown here: 11111110 + 00000001 = 11111111 = (or represents) -1 11111101 + 00000001 = 11111110 = (or represents) -2 11111100 + 00000001 = 11111101 = (or represents) -3 11111011 + 00000001 = 11111100 = (or represents) -4 11111010 + 00000001 = 11111011 = (or represents) -5 11111001 + 00000001 = 11111010 = (or represents) -6 11111000 + 00000001 = 11111001 = (or represents) -7 1's complement + 1 = 2's complement So 1's complement + 1 is known as the 'true' or 2's complement.
  • 11. So. To find a 2's complement representation of (say) the number -7 start with +7, ie. 00000111 Then invert (NOT) every bit to get the 1's complement. 11111000 Then add 1 to the number to get the 2's complement. 11111000 + 1 = 11111001 The MSB is a 1 so the number is negative, and this number now REPRESENTS -7 for calculation purposes.
  • 12. Subtraction in Binary Computers can only move binary information, and add it together. They cannot directly perform multiplication, subtraction or division. Subtraction of two binary numbers can only be done in a computer by adding together the normal representation of a positive number to the 2's complement of the negative number. For example:: 45 - 20 = 25 This can be expressed as: +45 + (-20) = +25
  • 13. +45 = 0010 1101 normal representation +20 = 0001 0100 normal representation -20 = 1110 1011 1's complement + 0000 0001 add 1 to give: -20 = 1110 1100 2's complement Note the process to get the 2's complement Now add: +45 = 0010 1101 normal representation -20 = 1110 1100 2's complement = (1)0001 1001 = 25 in decimal The "overflow" 9th bit above is ignored.