Grant Edwards <grant.b.edwa...@gmail.com> writes: > On 2021-11-20, Ben Bacarisse <ben.use...@bsb.me.uk> wrote: > >> You seem to be agreeing with me. It's the floating point part that is >> the issue, not the base itself. > > No, it's the base. Floating point can't represent 3/10 _because_ it's > base 2 floating point. Floating point in base 10 doesn't have any > problem representing 3/10.
Every base has the same problem for some numbers. It's the floating point part that causes the problem. Binary and decimal stand out because we write a lot of decimals in source code and computers use binary, but if decimal floating point were common (as it increasingly is) different fractions would become the oft quoted "surprise" results. -- Ben. -- https://mail.python.org/mailman/listinfo/python-list