Part 2: Binary Arithmetic One of the most common operations we perform on binary numbers (and all numbers) is addition. It can be cumbersome to convert your binary numbers to decimal just to add them and convert them back, so instead we will be learning how to add binary numbers directly. Binary addition works the same way as decimal addition, with the added restriction that each digit can only go up to 1. Let's consider the possibilities for adding the values of any 2 single digits together: 0 + 0 0 + 1 1 + 0 1 + 1 0 1 1 10 (remember that 10 in binary represents the number 2) In that last case, the result is larger than a single digit. When adding larger binary numbers, that means we have to carry the 1 over to the next column. This presents us with another new case: what happens if we have 1 + 1 + carried 1? In that case, the result is 11, which means that column's result is 1, and we carry 1 to the next column. Below is an example of adding two binary numbers that shows all cases:  carry:  1 1 1 1                                  in decimal              0 1 1 0 1 1 0 0                           108           + 0 0 1 1 1 0 1 0          =           +   58              1 0 1 0 0 1 1 0                           166 first column (1's place):         0 + 0 = 0 second column (2's place):    0 + 1 = 1 third column (4's place):        1 + 0 = 1 fourth column (8's place):     1 + 1 = 0, carry 1 fifth column (16's place):       0 + 1 + carried 1 = 0, carry 1 sixth column (32's place):      1 + 1 + carried 1 = 1, carry 1 seventh column (64's place): 1 + 0 + carried 1 = 0, carry 1 last column (128's place):      0 + 0 + carried 1 = 1    Exercise 4: What is 10001000 + 00101000? Show the result in binary. Exercise 5: What is 00011111 + 11000101? Show the result in decimal.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Part 2: Binary Arithmetic

One of the most common operations we perform on binary numbers (and all numbers) is addition. It can be cumbersome to convert your binary numbers to decimal just to add them and convert them back, so instead we will be learning how to add binary numbers directly.

Binary addition works the same way as decimal addition, with the added restriction that each digit can only go up to 1. Let's consider the possibilities for adding the values of any 2 single digits together:

0 + 0 0 + 1 1 + 0 1 + 1
0 1 1 10

(remember that 10 in binary represents the number 2)

In that last case, the result is larger than a single digit. When adding larger binary numbers, that means we have to carry the 1 over to the next column. This presents us with another new case: what happens if we have 1 + 1 + carried 1? In that case, the result is 11, which means that column's result is 1, and we carry 1 to the next column. Below is an example of adding two binary numbers that shows all cases:

 carry:  1 1 1 1                                  in decimal

             0 1 1 0 1 1 0 0                           108

          + 0 0 1 1 1 0 1 0          =           +   58

             1 0 1 0 0 1 1 0                           166

first column (1's place):         0 + 0 = 0

second column (2's place):    0 + 1 = 1

third column (4's place):        1 + 0 = 1

fourth column (8's place):     1 + 1 = 0, carry 1

fifth column (16's place):       0 + 1 + carried 1 = 0, carry 1

sixth column (32's place):      1 + 1 + carried 1 = 1, carry 1

seventh column (64's place): 1 + 0 + carried 1 = 0, carry 1

last column (128's place):      0 + 0 + carried 1 = 1 

 

Exercise 4: What is 10001000 + 00101000? Show the result in binary.

Exercise 5: What is 00011111 + 11000101? Show the result in decimal.

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Lower bounds sorting algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education