B CUSP 110B – Digital Thinking Homework 6: Colors
and Binary Numbers |
|
Colors And Binary
Numbers
Goals: Reading color representations and Practice with
Binary/Decimal number representations
Dark Gray
|
Light
Gray |
Black
|
White
|
Red-ish
|
Green-ish
|
Blue-ish
|
Floating point representations:
1. (0.3f, 0.3f, 0.3f)
2. (0.8f, 0.8f, 0.8f)
3. (0.2f, 0.2f, 0.9f)
4. (0.2f,
0.9f, 0.2f)
5. (0.9f, 0.2f, 0.2f)
6. (0.0f, 0.0f, 0.0f): Black
7. (1.0f, 1.0f, 1.0f)
Integer representations:
8. (180, 40, 40)
9. (40,
180, 40)
10. (40, 40, 180)
11. (0,
0, 0)
12. (180,
180, 180)
13. (30,
30, 30)
14. (255, 255, 255): White
A. Convert decimal 125 to binary:
Num Being Converted |
125 |
|
|
|
|
|
|
|
|
Place Value |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
Subtract |
|
|
|
|
|
|
|
|
|
Binary Num |
|
|
|
|
|
|
|
|
|
B. Convert decimal 387 to binary
Num Being Converted |
387 |
|
|
|
|
|
|
|
|
Place Value |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
Subtract |
|
|
|
|
|
|
|
|
|
Binary Num |
|
|
|
|
|
|
|
|
|
C. In class we have seen that 11012 (read: 1101-base2) has a decimal value of 13. What is the decimal value of
a. 10012
b. 1001012
c. 11011012
D. What are the sums for the following binary numbers (hint: convert to decimal to verify your answers), express your answers in binary.
a. 10012 + 10012
b. 10012 + 1001012
c. 1001012 + 11011012
In this homework assignment you have practice reading (RGB) color representation in both floating point and integer. You have also practiced decimal to binary conversion and performing addition with binary numbers.