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

Chris Angelico rosuav at gmail.com
Wed Sep 17 23:37:55 CEST 2014


On Thu, Sep 18, 2014 at 4:03 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Wed, Sep 17, 2014 at 9:10 AM, Chris Angelico <rosuav at gmail.com> wrote:
>> And while it's
>> conceivable to define that infinity divided by anything is infinity,
>> and infinity modulo anything is zero, that raises serious issues of
>> primality and such; I'm not sure that that would really help anything.
>
> I missed that this point was already discussed. Can you elaborate on
> the "serious issues of primality and such"? Since infinity is not a
> natural number, its primality is undefined, so I don't see the issue
> here.

It's not something I've personally worked with, so I'm trying to
dredge stuff up from my brain, but I think there's something along the
lines of "stuff shouldn't be a multiple of everything" and the Prime
Number Theorem. But that may just be a case where float != real.

ChrisA



More information about the Python-list mailing list