Reading the documentation

Chris Angelico rosuav at gmail.com
Fri Aug 25 09:15:34 EDT 2017


On Fri, Aug 25, 2017 at 11:01 PM, Steve D'Aprano
<steve+python at pearwood.info> wrote:
> How did we get onto prime factors of denominators? The point I was making is
> that there are plenty of fractions which are not multiples of 1/5 which
> nevertheless lead to unintuitive "wrong answers" in both Decimal and binary
> floating point. It is not necessary for the fraction to have a denominator
> which is a multiple of 5 to run into issues.

Yep. We're in agreement on that. My only point about the confusion was
the way in which you could get "wrong answers" in binary but "right
answers" in decimal, leading to the "0.1 + 0.2 != 0.3" problem. That's
a sum that works flawlessly in decimal but not in binary.

ChrisA



More information about the Python-list mailing list