Skip to content

BUG: isposinf and isneginf fail for complex values #11438

@jor-

Description

@jor-

The functions np.isposinf and np.isneginf fail for arrays with complex values.

>>> import numpy as np
>>> a = np.arange(2) + 1j
>>> np.isposinf(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/numpy/lib/ufunclike.py", line 34, in func
    return f(x, out=out, **kwargs)
  File "/usr/lib/python3/dist-packages/numpy/lib/ufunclike.py", line 141, in isposinf
    return nx.logical_and(nx.isinf(x), ~nx.signbit(x), out)
TypeError: ufunc 'signbit' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
>>> np.isneginf(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/numpy/lib/ufunclike.py", line 34, in func
    return f(x, out=out, **kwargs)
  File "/usr/lib/python3/dist-packages/numpy/lib/ufunclike.py", line 202, in isneginf
    return nx.logical_and(nx.isinf(x), nx.signbit(x), out)
TypeError: ufunc 'signbit' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

I used NumPy 1.14.5 and Python 3.6.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions