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 hope that the complex multiplication operation 
remains simple and easily explainable, not degenerating into a mass of special 
cases.

I'd be opposed to adding special-case handing for float-by-complex 
multiplication (i.e., doing anything other than promoting the float to a 
complex by introducing a zero imaginary part, and then doing normal complex 
multiplication).  But I don't think that's what Francesco is proposing.

FWIW, NumPy semantics follow those of Python, though that's hardly an 
independent data point.

In answer to Steven, IEEE 754 has precisely nothing to say on this subject: it 
simply doesn't cover complex arithmetic.

Francesco: by the way, I'd be interested to see the C source that gave you `inf 
+ nan*j` for this.  How did you initialise the arguments to the multiplication? 
C99 has a significant issue here (fixed in C2011), namely that there's no 
standard way to create a complex value with given real and imaginary parts.  
(Using real_part + I*imaginary_part doesn't count, because in the absence of 
the Imaginary type, which few compilers seem to implement, the real part of the 
"I" constant mucks up the arithmetic w.r.t. infinities, NaNs and signed zeros.)

----------

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

Reply via email to