Skip to content

Need for signbit in the array API spec #670

Closed
@oleksandr-pavlyk

Description

@oleksandr-pavlyk

The array specification for atan2 requires implementations to output -0.0 for some special values, e.g.

If x1_i is -0 and x2_i is +0, the result is -0.

which brings up a question on how implementors can distinguish between -0.0 and +0.0 in their test suite.

Equality testing spec mandates that these values be indistinguishable, and for a good reason.

The sign function also clamps these two values into +0.0.

I think this calls for the standard to have the signbit function:

  • numpy.signbit ref
  • cupy.signbit ref
  • torch.signbit ref
  • tf.experimental.numpy.signbit ref
  • dask.array.signbit ref
  • JAX does not seem to have signbit function, although it is implementable (example in one of JAX's issues)

Metadata

Metadata

Assignees

No one assigned

    Labels

    API extensionAdds new functions or objects to the API.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions