[issue22198] Odd floor-division corner case

2016-07-07 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker ___

[issue22198] Odd floor-division corner case

2015-04-17 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks for the ping, and sorry for forgetting about this. I'm -1 on applying this patch. I agree that floor division has some corner case issues (of which this is only one). But there's no clear agreement on what the right answer is, and I don't think

[issue22198] Odd floor-division corner case

2015-04-17 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- assignee: mark.dickinson - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___ ___

[issue22198] Odd floor-division corner case

2015-04-15 Thread Petr Viktorin
Petr Viktorin added the comment: ping? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22198] Odd floor-division corner case

2015-01-15 Thread Petr Viktorin
Petr Viktorin added the comment: ping, is there anything I can do to help push the patch forward? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___

[issue22198] Odd floor-division corner case

2015-01-15 Thread Mark Dickinson
Mark Dickinson added the comment: The patch is fine; I just need to find time to look at it properly. That might take a week or two. Sorry for the delay. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198

[issue22198] Odd floor-division corner case

2014-11-10 Thread Petr Viktorin
Petr Viktorin added the comment: ping, could someone please review the patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___ ___

[issue22198] Odd floor-division corner case

2014-10-09 Thread Petr Viktorin
Petr Viktorin added the comment: Apologies for the delay; I missed/did not get a notification. Alexander, I don't disagree, but I'd like my first patch to Python to not be a refactoring. As I said, I'd like to keep this patch focused. After that I'd like to provide tests the rest of

[issue22198] Odd floor-division corner case

2014-09-22 Thread Alexander Belopolsky
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- nosy: +belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___ ___

[issue22198] Odd floor-division corner case

2014-09-22 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I wonder if it would make sense to rewrite float_divmod using the newer POSIX/C99 remquo function. I believe it is designed to compute the exact value of round(x/y), but getting floor instead should not be hard. Its behavior on special values is fully

[issue22198] Odd floor-division corner case

2014-09-22 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___

[issue22198] Odd floor-division corner case

2014-09-22 Thread Case Van Horsen
Changes by Case Van Horsen cas...@gmail.com: -- nosy: +casevh ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___ ___ Python-bugs-list mailing

[issue22198] Odd floor-division corner case

2014-09-07 Thread Petr Viktorin
Petr Viktorin added the comment: I tried my hand at writing a patch. I hope it is helpful. The message of the 2001 commit that introduces this says that there's no platform-independent way to write a test case for this. I assume with @support.requires_IEEE_754 that is no longer true (at least

[issue22198] Odd floor-division corner case

2014-09-07 Thread Petr Viktorin
Petr Viktorin added the comment: Note: I signed the contributor agreement form recently, I should have a * soon. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___

[issue22198] Odd floor-division corner case

2014-08-16 Thread Mark Dickinson
Mark Dickinson added the comment: But in Py3 floor division of floats returns an integer. Not in my version! Python 3.4.1 (default, May 21 2014, 01:39:38) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin Type help, copyright, credits or license for more information. -3.0 //

[issue22198] Odd floor-division corner case

2014-08-16 Thread Tim Peters
Tim Peters added the comment: Sorry, Mark - I took a true thing and careleslly turned it into a false thing ;-) It's math.floor(a_float) that returns an int in Py3, not floor division of floats. So, yup, no real problem with returning -0.0 after all; it's just that it can't be _explained_

[issue22198] Odd floor-division corner case

2014-08-15 Thread Stefan Krah
Stefan Krah added the comment: I think the intention of the standard is pretty much as Mark said in msg225314. The fact that decimal behaves that way is another indicator, since Cowlishaw really tried to mirror the 2008 standard as closely as possible. --

[issue22198] Odd floor-division corner case

2014-08-15 Thread Tim Peters
Tim Peters added the comment: To be clear, I agree -0.0 is the correct answer, and -1.0 is at best defensible via a mostly-inappropriate limit argument. But in Py3 floor division of floats returns an integer, and there is no integer -0. Nor, God willing, will there ever be ;-) Looks to me

[issue22198] Odd floor-division corner case

2014-08-15 Thread eryksun
eryksun added the comment: decimal.Decimal 'floor division' is integer division that truncates toward 0 (see 9.4.2). Decimal('-0.5').__floor__() -1 Decimal('-0.5').__floordiv__(1) Decimal('-0') Numpy 1.8.1: np.float32(-0.5) // 1 -1.0 np.float32(-0.5) //

[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson
New submission from Mark Dickinson: I'm not sure it's worth fixing this, but it seems worth recording: -0.5 // float('inf') -1.0 I was expecting a value of `-0.0`, and while IEEE 754 doesn't cover the floor division operation, I'm reasonably confident that that's the value it would have

[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___ ___ Python-bugs-list mailing

[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +tim.peters ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___ ___ Python-bugs-list

[issue22198] Odd floor-division corner case

2014-08-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, Aug 14, 2014 at 04:47:41PM +, Mark Dickinson wrote: I'm not sure it's worth fixing this, but it seems worth recording: -0.5 // float('inf') -1.0 I was expecting a value of `-0.0`, and while IEEE 754 doesn't cover the floor division

[issue22198] Odd floor-division corner case

2014-08-14 Thread Tim Peters
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

[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson
Mark Dickinson added the comment: Steven: there's a set of (unwritten) rules for how the IEEE 754 operations work. (I think they actually *were* articulated explicitly in some of the 754r drafts, but didn't make it into the final version.) One of them is that ideally, a floating-point

[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson
Mark Dickinson added the comment: [Tim] -0.5 // float('inf') nan Urk! I wonder what's going on there. I think I like that answer even less than -1.0. IEEE 754's floor does indeed take -0.0 to -0.0. -- ___ Python tracker rep...@bugs.python.org

[issue22198] Odd floor-division corner case

2014-08-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: ideally, a floating-point operations works as though the corresponding mathematical operation were performed exactly on the inputs (considered as real numbers), followed by a rounding step that takes the resulting real number and rounds it to the