3 ms·
On the other hand, decimal floating point would fail with 1/3 + 1/3 != 2/3. The general rule is that, in base b, you have finite positional ("decimal") represe
by pdpi 2mo ago
On the other hand, decimal floating point would fail with 1/3 + 1/3 != 2/3.
The general rule is that, in base b, you have finite positional ("decimal") representations of numbers p/q where q is a divisor of bˆn for some n. So e.g. 1/10 doesn't have a finite binary representation because 10 = 2 * 5, and that factor 5 ensures 10 is never a divisor of a power of 2. Likewise, 3 is coprime with 10, so you can't represent 1/3 in decimal.