[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2016-05-16 Thread Aaron Meurer
Changes by Aaron Meurer : -- nosy: +Aaron.Meurer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-22 Thread Francesco Biscani
Francesco Biscani added the comment: @Mark Yes I understand that this is a thorny issue. I was kinda hoping NumPy would just forward complex arithmetic to the underlying C implementation, but apparently that's not the case (which OTOH makes sense as the use of C99 complex numbers is not that

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks for the update. I'm not too worried about performance: I suspect that any additional overhead would be lost in the overhead of the Python machinery. It would be worth profiling to check, of course, before any change went in. I'd expect that most perfor

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Francesco Biscani
Francesco Biscani added the comment: Hi Mark, the original code is C++, and the inf + nanj result can be reproduced by the following snippet: """ #include #include int main(int argc, char * argv[]) { std::cout << std::complex(3,0) / 0. << '\n'; return 0; } """ Here is the C99 version:

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: +tim.peters ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Mark Dickinson
Mark Dickinson added the comment: If the proposal is to add C99 Appendix G-style handling of nan+nanj results for complex multiplication, that doesn't seem unreasonable to me, though I'm not particularly convinced that the gain in complexity is worth it. So -0 from me. Whatever happens, I'd h

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Mark Dickinson
Mark Dickinson added the comment: Changing Python versions and issue type: the current behaviour is certainly deliberate, so a proposal to change it would be a feature request, which could only land in Python 3.6 or later. -- type: behavior -> enhancement versions: -Python 2.7, Python

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Eric V. Smith
Eric V. Smith added the comment: > Berker Peksag added the comment: > >> Also, it would be best to take this discussion of how to produce a patch to >> the python-committers mailing list: > > or the core-mentorship list: > https://mail.python.org/mailman/listinfo/core-mentorship :) Argh! Tha

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Berker Peksag
Berker Peksag added the comment: > Also, it would be best to take this discussion of how to produce a patch to > the python-committers mailing list: or the core-mentorship list: https://mail.python.org/mailman/listinfo/core-mentorship :) -- nosy: +berker.peksag __

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Eric V. Smith
Eric V. Smith added the comment: Saksham: Also, it would be best to take this discussion of how to produce a patch to the python-committers mailing list: https://mail.python.org/mailman/listinfo/python-committers -- ___ Python tracker

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Eric V. Smith
Eric V. Smith added the comment: Saksham: First we need our "experts" to decide what, if any, change is needed. If we decide that a change is needed, at that point we'd look at a patch. -- ___ Python tracker _

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Saksham Agrawal
Saksham Agrawal added the comment: I read the first 6 chapters of the devguide. Now how should I proceed. -- ___ Python tracker ___ _

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Francesco Biscani
Francesco Biscani added the comment: The best reference I could find so far is in the C99 standard: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf Annex G is titled "IEC 60559-compatible complex arithmetic". In G.3.1 it is written: """ A complex or imaginary value with at least one

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm not entirely satisfied that the way it is calculated by C++11/C99 is correct. (Although I can see the appeal of the C version.) Mathematically, complex multiplication (a+bj)*x should be identical to (a+bj)*(x+0j), but obviously in the presence of NANs tha

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Ezio Melotti
Ezio Melotti added the comment: Saksham, if you would like to work on this issue you can check the devguide for more information. -- components: +Interpreter Core nosy: +eric.smith, ezio.melotti, lemburg, mark.dickinson, stutzbach versions: +Python 3.4, Python 3.5, Python 3.6 -Python 3.

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Saksham Agrawal
Saksham Agrawal added the comment: Hi Would like to work on this bug...but I am new, would like some guidance Please help me -- nosy: +Saksham Agrawal ___ Python tracker ___ __

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Francesco Biscani
New submission from Francesco Biscani: The C++11/C99 standards define a complex infinity as a complex number in which at least one of the components is inf. Consider the Python snippet: >>> complex(float('inf'),float('nan'))*2 (nan+nanj) This happens because complex multiplication in Python is