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

cool-RR ram.rachum at gmail.com
Thu Sep 18 10:43:10 CEST 2014

On Thursday, September 18, 2014 6:12:08 AM UTC+3, Steven D'Aprano wrote:
> cool-RR wrote:
> > Chris, why is this invariant `div*y + mod == x` so important? Maybe it's
> > more important to return a mathematically reasonable result for the the
> > floor-division result than to maintain this invariant?
> You keep talking about floor(inf) == inf being "mathematically reasonable",
> but I'm not convinced that it is. Can you justify why you think it is
> mathematically reasonable?


> [1] But *which* mathematical infinity? One of the cardinal infinities, the
> alephs, or one of the ordinal infinities, the omegas and the epsilons?

The alephs are about sizes of sets, they have nothing to do with limits. When talking about limits, which is what this is about, there is no need for any variety of infinities.


More information about the Python-list mailing list