Concept
How do you convert between binary and decimal?
Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk / Chapter 1
"Converting from binary to decimal was demonstrated above, with 110101₂ = 53₁₀. To go the other way, we follow the algorithm from page 170. Let’s try it for the decimal number 49: 1. (Step 1) We first compute 49 mod 2. Doing “mod 2” is easy: you just see whether the number is even or odd. In this case, it’s odd, so the remainder is a 1. 2. (Step 2) Now divide 49 by 2 and take the floor, which gives ⌊49 ÷ 2⌋ = 24. It’s not zero, so we perform step 2b: make 24 our new value, move our pencil to the left of the 1, and go back to step 1. 3. (Step 1) Compute 24 mod 2. Since 24 is even, this is zero, which we write down to the left of the 1:"
Related Ideas
- How do you convert between binary and hexadecimal using nibbles?Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk · Chapter 1
- What is the binary number 1011001110101010₂ in decimal?Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk · Chapter 1
- How can you convert a decimal number to hexadecimal using modulo and floor?Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk · Chapter 1
- What do you do after taking the floor of 6 divided by 2?Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk · Chapter 1
- What happens after dividing 3 by 2 and taking the floor?Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk · Chapter 1
- What value does the binary number 1010 represent as an unsigned number?Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk · Chapter 1
- How are numbers interpreted in a base 7 system?Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk · Chapter 1
- How does a base determine the symbols and place values used to represent numbers?Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk · Chapter 1