msg10312 - (view) |
Author: Hernan Foffani (hfoffani) |
Date: 2002-04-13 13:46 |
PEP 238 says: "For complex numbers, // raises an exception, since floor() of a complex number is not allowed." But on 2.3 (and on CVS) complex floor division returns divmod[0] Is this a bug on complexobject.c or the PEP wasn't updated? Regards, -Hernan |
|
|
msg10313 - (view) |
Author: Hernan Foffani (hfoffani) |
Date: 2002-04-14 23:24 |
Logged In: YES user_id=112690 As suggested by Tim I'll upload here the patch and the test for this bug. The patch clears nb_true_divide entry and deletes the complex_int_div function. |
|
|
msg10314 - (view) |
Author: Guido van Rossum (gvanrossum) *  |
Date: 2002-04-15 00:44 |
Logged In: YES user_id=6380 Hm. I believe that if divmod() returns something, // should return the same thing (well, divmod()[0]). But what on earth does divmod() do on two complex numbers??? Does it make sense to have divmod() on complex at all? Assigned to Tim for a ruling. |
|
|
msg10315 - (view) |
Author: Tim Peters (tim.peters) *  |
Date: 2002-04-15 01:23 |
Logged In: YES user_id=31435 Heh. divmod(c1, c2)[0] for complexes returns floor((c1/c2).real) according to the Reference Manual (5.6 Binary arithmetic operations), and it looks like the code implements that just so. The Library manual's "Builtin Functions" section only mentions ints, longs and floats, while the same manual's "2.2.4 Numeric Types" claims, in a footnote, that "Builtin Functions" told the full truth about divmod. The primary lesson I take from this is that a .chm file is a truly wonderful way to search the docs . I don't think divmod is useful for complexes, and would be happy to see it go away. But I guess that means taking the full-blown deprecation path. I note that the original complexobject.c didn't implement divmod. The current divmod appears to derive from a patch contributed by Tim Hochberg, in rev 2.10 in 1996. You (Guido) added a question mark to the checkin comment, so I figure it never made much sense to you either. I agree floor divsion and divmod(...)[0] should do the same thing, whatever that is. |
|
|
msg10316 - (view) |
Author: Guido van Rossum (gvanrossum) *  |
Date: 2002-04-15 01:36 |
Logged In: YES user_id=6380 OK, I'll add the deprecation warning. |
|
|
msg10317 - (view) |
Author: Guido van Rossum (gvanrossum) *  |
Date: 2002-04-15 01:42 |
Logged In: YES user_id=6380 Fred, can you fix the docs? |
|
|
msg10318 - (view) |
Author: Guido van Rossum (gvanrossum) *  |
Date: 2002-04-15 12:37 |
Logged In: YES user_id=6380 Note: complex % is also being deprecated. |
|
|
msg10319 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2002-05-13 06:29 |
Logged In: YES user_id=80475 Fred, here's a doc patch. Okay to commit and close this bug? |
|
|
msg10320 - (view) |
Author: Fred Drake (fdrake)  |
Date: 2002-05-21 16:10 |
Logged In: YES user_id=3066 The \deprecated markup should always be a separate paragraph (or list item). Please revise the doc patch and re-submit for review. (But thanks for working on this; the content is good!) |
|
|
msg10321 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2002-05-21 17:46 |
Logged In: YES user_id=80475 Separated the \deprecated sections. Revised patch attached. |
|
|
msg10322 - (view) |
Author: Fred Drake (fdrake)  |
Date: 2002-05-21 17:54 |
Logged In: YES user_id=3066 Thanks! Go ahead and check it in. |
|
|
msg10323 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2002-05-21 18:21 |
Logged In: YES user_id=80475 Committed as: libfuncs.tex 1.106 libstdtypes.tex 1.94 ref5.tex 1.62 Closing patch. |
|
|