Unexpected behaviour of math.floor, round and int functions (rounding)

Chris Angelico rosuav at gmail.com
Sat Nov 20 21:40:28 EST 2021


On Sun, Nov 21, 2021 at 1:20 PM Rob Cliffe via Python-list
<python-list at python.org> wrote:
>
>
>
> On 21/11/2021 01:02, Chris Angelico wrote:
> >
> > If you have a number with a finite binary representation, you can
> > guarantee that it can be represented finitely in decimal too.
> > Infinitely repeating expansions come from denominators that are
> > coprime with the numeric base.
> >
> >
> Not quite, e.g. 1/14 is a repeating decimal but 14 and 10 are not coprime.
> I believe it is correct to say that infinitely recurring expansions
> occur when the denominator is divisible by a prime that does not divide
> the base.
> Rob Cliffe

True, my bad. I can't remember if there's a term for that, but your
description is correct.

ChrisA


More information about the Python-list mailing list