positional-numbering-system.md (844B)
1 +++ 2 title = 'Positional numbering system' 3 template = 'page-math.html' 4 +++ 5 # Positional numbering system 6 Z is a set of {-inf…0…inf} integers 7 8 define an alphabet ∑ 9 10 A string X of n elements from ∑: Xn is in ∑n 11 12 Apply Xn to a valuation function F 13 14 For a base-10 system (radix = 10): 15 16 $ 17 \begin{aligned} 18 277_{10} &= \begin{array}{c|c|c} 10^{2} & 10^{1} & 10^{0} \\\\ \\hline 2 & 7 & 7 \end{array} \\\\ 19 &= 2(10^{2}) + 7(10) + 7(1) 20 \end{aligned} 21 $ 22 23 How do you choose a representation? 24 - representation of special values/cases (e.g. 0) 25 - range of values that can be represented 26 - efficiency of implementation (common operations?) 27 28 Unsigned integer representation: 29 30 $ 31 F : x_{n-1} \cdot 2^{n-1} + x_{n-2} \cdot 2^{n-2} + \dots + x_{0} \cdot 2^{0} 32 $ 33 34 Range: 2ⁿ-1 (total 2ⁿ, but one of those is 0) 35 36 Can overflow, so have to detect — carry