Odd floor-division corner case

Ian Kelly ian.g.kelly at gmail.com
Thu Aug 14 13:46:30 EDT 2014


On Thu, Aug 14, 2014 at 11:31 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> From http://bugs.python.org/issue22198
>
>>>> -0.5 // float('inf')
> -1.0

Looks like the result is the same for any negative dividend.

> What should it be?

It's surprising, but I think it's correct. A negative infinitesimal
would be less than 0, so its floor should be -1, not 0.



More information about the Python-list mailing list