News for hackers. Stuff that matters.
Re:Log is non-monotonic in PHP and Lua by brewmarche on Wednesday July 29, 2026 @04:57AM (#49094951)
> 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.

Re:Log is non-monotonic in PHP and Lua by pdpi on Wednesday July 29, 2026 @06:06AM (#49095410)
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.