Basic Computer Math Conversion of Numbers of Different Bases to Decimals Consider the number 97531. This is really: 9×10000 + 7×1000 + 5×100 + 3×10 + 1. This can also be written as: 9×104 + 7×103 + 5×102 + 3×101 + 1×100. There is nothing special about why we use base 10 except that humans have ten fingers. In the world of electronics, the natural base is two, because it only has two states: on and off. We use “1” to signify on, and “0” to signify off. This is referred to as the “binary system.” Example 1: Consider the binary number 1101011001. To convert this to its decimal equivalent, we rewrite it as: 1×29 + 1×28 + 0×27 + 1×26 + 0× 25 + 1×24 + 1×23 + 0×22 + 0×21 + 1×20. Or: 1×512 +1× 256 + 0×128 + 1×64 + 0×32 + 1×16 + 1×8 + 0×4 + 0×2 + 1 = 857. Computational Devise “A” Powers of 2 Binary Digits Their Product 1024 512 256 128 64 32 16 8 4 2 1 1 512 1 256 0 0 1 64 0 0 1 16 1 8 0 0 0 0 1 1 Their sum: 512 + 256 + 0 + 64 + 0 + 16 + 8 + 0 + 0 + 1 = 857 Suppose we were to use another base, say “b.” That would mean that the numbers representing the amounts multiplying their powers would range from “0” to one less that the base, i.e. “b-1.” For example, in base ten, these numbers range from “0” to “9.” That is why in base two we only have “0” and “1.” The commonly used base in Information science is base sixteen, or hexadecimal (“hex” means six and “deci” refers to tenth). 1 Example 2: Consider the base four number (1023)4. Notice the numbers range between “0” and “3,” the subscript “4” indicates the base of the number. 1×43 0×42 + 2×41 + 3×40 1×64 + 0×16 + 2×4 + 3×1 = 73 Powers of 4 256 Base 4 Digits Their Product 64 16 4 1 1 64 0 0 2 8 3 3 Adding the digits in the last row: 64 + 0 + 8 + 1 = 73 Example 3: (647)8 6×82 + 4×81 + 7×80 6×64 + 4×8 + 7×1 = 415 Powers of 8 512 Octal Digits Their Product 64 8 1 6 384 4 24 7 7 The sum of the digits in the last row 384 + 24 + 7 = 415 Notice that we have chosen bases that are powers of two. Those are the numbers that followed the progression within computer science. Because it is more convenient to use higher bases to represent quantities because it requires less space, or slots, to do so. The final base that the computational progression settled on was base sixteen or hexadecimal. Using base16, the range of numbers multiplying the powers of the base have to range between “0” and “fifteen.” However, it was decided to represent the amounts from “ten” to “fifteen” by the letter A, B, C, D, E and F (i.e. A=10, B=11, C=12, D=13, C=14 and F=15). Example 4: (D3)16 D×161 + 3×160 D×16 + 3×1 = 13×16 + 3×1 = 209 Most of the hexadecimal numbers used in computer math will only have two places, thus representing numbers from 0 to FF (or 0 to 255). 2 Conversion of Decimals Numbers to Different Bases Consider the number 97531. Computational Devise “B” Base Divisor 10 10 10 10 10 Dividend/Quotient 97531 9753 975 97 9 0 Remainder 1 3 5 7 9 Check: Powers of 1 100000 Decimal Digits Their Product 10000 1000 100 10 1 9 90000 7 7000 5 500 3 30 1 1 The sum of the digits in the last row is: 90000 + 7000 + 500 + 30 +1 = 97531 Notice how when you divide each dividend the remainder is the quantity that multiplies the base to the next lower power. And when you have a quotient of “0” you have finished, and the final remainder is the quantity that multiplies the highest powered base. Example 5: Convert the decimal number 25 to its binary equivalent. Base Divisor 2 2 2 2 2 Dividend/Quotient 25 12 6 3 1 0 3 Remainder 1 0 0 1 1 Check: Powers of 2 1024 512 256 128 64 32 Binary Digits Their Product 16 8 4 2 1 1 16 1 8 0 0 1 0 1 1 The sum of the digits in the last row 16×1 + 1×8 + 0×4 + 1×2 + 1×1 = 25 Example 6: (48307)16 Base Divisor 16 16 16 16 16 Dividend/Quotient 48307 3019 188 11 0 Remainder 3 11 12 = C 11 = B Check: Powers of 16 4096 256 16 1 Hexadecimal Digits Their Product B = 11 45056 C = 12 3072 11 176 3 3 Their sum 45056 + 3072 + 176 +3 = 48307 4 Hexadecimal Equivalents to the Decimal Numbers 0–255 Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 E0 E1 E3 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF 5
© Copyright 2026 Paperzz