SlideShare a Scribd company logo
1 of 13
Download to read offline
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

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 baseseLearningJa
 
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 HTMLMarlon Jamera
 
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 numbersMohammad Bashartullah
 

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

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
 
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
 
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

A Software Requirements Specification
A Software Requirements SpecificationA Software Requirements Specification
A Software Requirements Specificationadil 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 Vehiclesadil raja
 
DevOps Demystified
DevOps DemystifiedDevOps Demystified
DevOps Demystifiedadil 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 Researchadil raja
 
The Knock Knock Protocol
The Knock Knock ProtocolThe Knock Knock Protocol
The Knock Knock Protocoladil raja
 
File Transfer Through Sockets
File Transfer Through SocketsFile Transfer Through Sockets
File Transfer Through Socketsadil raja
 
Remote Command Execution
Remote Command ExecutionRemote Command Execution
Remote Command Executionadil 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 Pakistanadil raja
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousingadil 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 VoIPadil raja
 
ULMAN GUI Specifications
ULMAN GUI SpecificationsULMAN GUI Specifications
ULMAN GUI Specificationsadil 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
 
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

South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...
South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...
South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...gragchanchal546
 
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书c6eb683559b3
 
一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书F
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdfMatthew Sinclair
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理F
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdfMatthew Sinclair
 
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理AS
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制pxcywzqs
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查ydyuyu
 
Research Assignment - NIST SP800 [172 A] - Presentation.pptx
Research Assignment - NIST SP800 [172 A] - Presentation.pptxResearch Assignment - NIST SP800 [172 A] - Presentation.pptx
Research Assignment - NIST SP800 [172 A] - Presentation.pptxi191686
 
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...Sareena Khatun
 
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime BalliaBallia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Balliameghakumariji156
 
Washington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers ShirtWashington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers Shirtrahman018755
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"growthgrids
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.krishnachandrapal52
 
Call Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budget
Call Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budgetCall Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budget
Call Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budgetkumargunjan9515
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrHenryBriggs2
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsPriya Reddy
 

Recently uploaded (20)

South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...
South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...
South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...
 
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
 
一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
Research Assignment - NIST SP800 [172 A] - Presentation.pptx
Research Assignment - NIST SP800 [172 A] - Presentation.pptxResearch Assignment - NIST SP800 [172 A] - Presentation.pptx
Research Assignment - NIST SP800 [172 A] - Presentation.pptx
 
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...
 
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime BalliaBallia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
 
Washington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers ShirtWashington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers Shirt
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
Call Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budget
Call Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budgetCall Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budget
Call Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budget
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 

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.