Technical Computer Science
Number Representations
Thorsten Thormählen
October 22, 2024
Part 2, Chapter 1
Thorsten Thormählen
October 22, 2024
Part 2, Chapter 1
This is the print version of the slides.
Advance slides with the → key or
by clicking on the right border of the slide
Slides can also be advanced by clicking on the left or right border of the slide.
Type | Font | Examples |
---|---|---|
Variables (scalars) | italics | $a, b, x, y$ |
Functions | upright | $\mathrm{f}, \mathrm{g}(x), \mathrm{max}(x)$ |
Vectors | bold, elements row-wise | $\mathbf{a}, \mathbf{b}= \begin{pmatrix}x\\y\end{pmatrix} = (x, y)^\top,$ $\mathbf{B}=(x, y, z)^\top$ |
Matrices | Typewriter | $\mathtt{A}, \mathtt{B}= \begin{bmatrix}a & b\\c & d\end{bmatrix}$ |
Sets | calligraphic | $\mathcal{A}, B=\{a, b\}, b \in \mathcal{B}$ |
Number systems, Coordinate spaces | double-struck | $\mathbb{N}, \mathbb{Z}, \mathbb{R}^2, \mathbb{R}^3$ |
There are only 10 types of people in the world: those who understand binary, and those who don't.
Number symbol | Value |
---|---|
$\mathrm{I}$ | 1 |
$\mathrm{V}$ | 5 |
$\mathrm{X}$ | 10 |
$\mathrm{L}$ | 50 |
$\mathrm{C}$ | 100 |
$\mathrm{D}$ | 500 |
$\mathrm{M}$ | 1000 |
$\mathrm{I}$ | = 1 | $\mathrm{X}$ | = 10 |
$\mathrm{II}$ | = 2 | $\mathrm{XI}$ | = (10+1) = 11 |
$\mathrm{III}$ | = 3 | $\mathrm{XII}$ | = (10+2) = 12 |
$\mathrm{IV}$ | = (5-1) = 4 | $\mathrm{XXXIX}$ | = (30+10-1) = 39 |
$\mathrm{V}$ | = 5 | $\mathrm{XL}$ | = (50-10) = 40 |
$\mathrm{VI}$ | = (5+1) = 6 | $\mathrm{L}$ | = 50 |
$\mathrm{VII}$ | = (5+2) = 7 | $\mathrm{LIX}$ | = (50+10-1)=59 |
$\mathrm{VIII}$ | = (5+3) = 8 | $\mathrm{LX}$ | = 60 |
$\mathrm{IX}$ | = (10-1) = 9 | $\mathrm{XC}$ | = (100-10) = 90 |
Base (top): Base (bottom):
There are 10 kinds of people in the world: those that understand binary, those that don't, and those that didn't expect this joke to be in ternary.
$10^1 $ | $10^2 $ | $10^3 $ | $10^6 $ | $10^9 $ | $10^{12}$ | $10^{15}$ | $10^{18}$ | $10^{21}$ | $10^{24}$ |
deca | hecto | kilo | mega | giga | tera | peta | exa | zetta | yotta |
da | h | k | M | G | T | P | E | Z | Y |
$10^{-1}$ | $10^{-2} $ | $10^{-3} $ | $10^{-6} $ | $10^{-9} $ | $10^{-12}$ | $10^{-15}$ | $10^{-18}$ | $10^{-21}$ | $10^{-24}$ |
deci | centi | milli | micro | nano | pico | femto | atto | zepto | yocto |
d | c | m | µ | n | p | f | a | z | y |
Name | Prefix | Value |
---|---|---|
kibi | Ki | $2^{10} = 1024^{1} =1.024$ |
mebi | Mi | $2^{20} =1024^{2} =1.048.576$ |
gibi | Gi | $2^{30} =1024^{3} =1.073.741.824$ |
tebi | Ti | $2^{40} =1024^{4} =1.099.511.627.776$ |
pebi | Pi | $2^{50} =1024^{5} =1.125.899.906.842.624$ |
exbi | Ei | $2^{60} =1024^{6} =1.152.921.504.606.846.976$ |
zebi | Zi | $2^{70} =1024^{7} =1.180.591.620.717.411.303.424$ |
yobi | Yi | $2^{80} =1024^{8} =1.208.925.819.614.629.174.706.176$ |
6485 / 2 = 3242 remainder 1 3242 / 2 = 1621 remainder 0 1621 / 2 = 810 remainder 1 810 / 2 = 405 remainder 0 405 / 2 = 202 remainder 1 202 / 2 = 101 remainder 0 101 / 2 = 50 remainder 1 50 / 2 = 25 remainder 0 25 / 2 = 12 remainder 1 12 / 2 = 6 remainder 0 6 / 2 = 3 remainder 0 3 / 2 = 1 remainder 1 1 / 2 = 0 remainder 1
23521 / 16 = 1470 Rest 1 (1) 1470 / 16 = 91 Rest 14 (E) 91 / 16 = 5 Rest 11 (B) 5 / 16 = 0 Rest 5 (5)
189 / 5 = 37 Rest 4 37 / 5 = 7 Rest 2 7 / 5 = 1 Rest 2 1 / 5 = 0 Rest 1
0000 = 0 | 0100 = 4 | 1000 = 8 | 1100 = C |
0001 = 1 | 0101 = 5 | 1001 = 9 | 1101 = D |
0010 = 2 | 0110 = 6 | 1010 = A | 1110 = E |
0011 = 3 | 0111 = 7 | 1011 = B | 1111 = F |
If only dead people understand hexadecimal, how many people understand hexadecimal?
$\begin{align}(DEAD)_{16} = &13 \cdot 16^3 + 14 \cdot 16^2 \\ &+ 10 \cdot 16^1 + 13 \cdot 16^0 = (57005)_{10}\end{align}$
0,6875 * 2 = 1.375 0,375 * 2 = 0.75 0,75 * 2 = 1.5 0,5 * 2 = 1.0
0,1 * 2 = 0.2 0,2 * 2 = 0.4 0,4 * 2 = 0.8 0,8 * 2 = 1.6 0,6 * 2 = 1.2 0,2 * 2 = 0.4 0,4 * 2 = ...
double a = 0.1; double b = a * 3; if(a == 0.1) print("This is "); if(b == 0.3) print("no"); else print("a"); print(" round-off error\n");
Please notify me by e-mail if you have questions, suggestions for improvement, or found typos: Contact