Message225313
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. |
|
Date |
User |
Action |
Args |
2014-08-14 19:40:49 | tim.peters | set | recipients:
+ tim.peters, mark.dickinson, steven.daprano, skrah |
2014-08-14 19:40:49 | tim.peters | set | messageid: <1408045249.79.0.627071551442.issue22198@psf.upfronthosting.co.za> |
2014-08-14 19:40:49 | tim.peters | link | issue22198 messages |
2014-08-14 19:40:49 | tim.peters | create | |
|