Tim Peters added the comment:

I'm OK with -1, but I don't get that or -0.0 on 32-bit Windows Py 3.4.1:

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit 
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> -0.5 // float('inf')
nan

So maybe NaN is the best answer ;-)

In favor of -1.0:  that _is_ the limit of the mathematical floor(-0.5 / x) as x 
approaches +infinity.

In favor of -0.0:  it "should be" mathematically that floor_division(x/y) = 
floor(x / y), and floor(-0.5 / inf) = floor(-0.0) = ... well, not -0.0!  
floor() in Py3 is defined to return an integer, and there is no -0 integer:


>>> floor(-0.0)
0

That's +0.  So I see no justification at all for -0.0 in Py3.  -1 seems the 
best that can be done.  The NaN I actually get doesn't make sense.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22198>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to