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

Rob Cliffe rob.cliffe at btinternet.com
Sat Nov 20 21:18:56 EST 2021



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


More information about the Python-list mailing list