Open
Description
Describe the issue:
It seems, that numpy uses Smith's algorithm to do complex true division. In some cases (see below) it produces (nan+nanj)
, but meaningful components could be recovered. See e.g. C11 Annex G.5.2, _Cdivd()
's example.
FYI: see also CPython's issue python/cpython#119372
Reproduce the code example:
>>> 1/np.complex128('inf')
0j
>>> 1/np.complex128('infj')
-0j
>>> 1/np.complex128('(inf+infj)') # oops, should be 0j
<stdin>:1: RuntimeWarning: invalid value encountered in scalar divide
(nan+nanj)
Error message:
No response
Python and NumPy Versions:
>>> np.__version__
'1.26.4'
Runtime Environment:
No response
Context for the issue:
No response