3 ms·
> The usual "0.1 + 0.2 != 0.3" is _not_ imprecision. Correct. That’s using the wrong base. Decimal floating point doesn’t have that problem.
by brewmarche 2mo ago
> The usual "0.1 + 0.2 != 0.3" is _not_ imprecision.
Correct. That’s using the wrong base. Decimal floating point doesn’t have that problem.
- pdpi 2mo agoOn 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.