Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`

Chris Angelico rosuav at gmail.com
Thu Sep 18 05:47:12 CEST 2014


On Thu, Sep 18, 2014 at 1:29 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Perhaps you are thinking of the Fundamental Theorem of Arithmetic, which
> states that every positive integer except 1 can be uniquely factorized into
> a product of one or more primes?
>
> http://mathworld.wolfram.com/FundamentalTheoremofArithmetic.html
>
> But that doesn't apply to infinity, which isn't an integer.

May have been that, or maybe was something different altogether. I was
trying to relocate the info I'd been reading (ages ago), but without
success. To be honest, I was hoping someone else would do the "Of
course, I know what you mean" part for me :) But it's ended up more
like the Goon Show: "How do you intend tipping Mount Everest on its
side?" "Well, isn't it obvious?" with no result forthcoming. Sorry for
the noise!

Infinities are plenty weird, just this one specific weirdness wasn't right.

ChrisA



More information about the Python-list mailing list