Skip to content

sign of complex 0+0j returns complex nan #166

Description

@WarrenWeckesser

Example:

In [3]: import array_api_strict as aa

In [4]: z = aa.zeros(1, dtype=aa.complex128)

In [5]: aa.sign(z)
/home/warren/py3.13.5/lib/python3.13/site-packages/array_api_strict/_array_object.py:970: RuntimeWarning: invalid value encountered in divide
  res = self._array.__truediv__(other._array)
Out[5]: Array([nan+nanj], dtype=array_api_strict.complex128)

The result should be Array([0+0j], ...).

Special handling of the complex case was added in #74, but that change didn't consider the input 0+0j.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions