Data Representation | Program Representation | |||||
string int x[3] char x 0x9cd0f0ad 01101011 |
Objects Arrays Primitive types Addresses bits |
Java code C++ code C code x86 code IBCM hexadecimal |
High-level language Low-level language Assembly language Machine code |
Radix R to decimal:
\( n = d_n R^n + \ldots + d_0 R^0 \)
Decimal to radix R:
\( \frac{n}{R} = d_n R^{n-1} + \ldots + d_1 R^0 \), remainder \( d_0 \)
\( 42_5 \)
\( 121_3 \)
\( 42_{10} \) to radix 5
\( 121_{10} \) to radix 11
n-bit binary number: \( b_{n-1} b_{n-2} b_{n-3} \ldots b_2 b_1 b_0 \)
Value = \( \sum_{i=0}^{n-1} b_i \cdot 2^i \)
Boolean arithmetic:
Maximum value is \( 2^n-1 \) -- but what should \( n \) be?
|
|
This is an actual comment left by a graduating SEAS computer science major:
I can't count the number of times I was taught how to count in binary
So this material may appear again in the CS curriculum. Hopefully everybody will (eventually) learn it...
\( \text{value} = (1-2*\text{sign}) * (1 + \text{mantissa}) * 2^{\text{exponent}-127} \)
\( b_{1}b_{2}b_{3}b_{4}b_{5}b_{6}b_{7}b_{8}b_{9}b_{10}b_{11}b_{12}b_{13}b_{14}b_{15}b_{16}b_{17}b_{18}b_{19}b_{20}b_{21}b_{22}b_{23} \)
\( \text{mantissa} = 1.0 + \sum^{23}_{i=1} \frac{b_i}{2^i} \)
Click the center of the target
Close window