You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ python3 -c 'print(1.0<1.0+1.0j)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: '<' not supported between instances of 'float' and 'complex'
$ python3 -c 'import numpy; print(1.0<numpy.complex64(1.0+1.0j))'
True
$ python3 -c 'import numpy; print(1.0<numpy.complex64(1.0-1.0j))'
False
NumPy/Python version information:
1.17.4 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0]
The bare python implementation throws an error, as it should. The behavior of the numpy.complex64 class shows behavior that is inconsistent with that, doesn't make sense mathematically, and doesn't seem to be documented anywhere. It appears to be doing a lexicographic comparison of real and imaginary parts. It should throw a type error instead. Since the present behavior does not seem to be defined anywhere, nobody should be depending on the undefined behavior, and fixing it should not cause problems.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Reproducing code example:
NumPy/Python version information:
1.17.4 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0]
The bare python implementation throws an error, as it should. The behavior of the numpy.complex64 class shows behavior that is inconsistent with that, doesn't make sense mathematically, and doesn't seem to be documented anywhere. It appears to be doing a lexicographic comparison of real and imaginary parts. It should throw a type error instead. Since the present behavior does not seem to be defined anywhere, nobody should be depending on the undefined behavior, and fixing it should not cause problems.
The text was updated successfully, but these errors were encountered: