Skip to content

Negative zero not preserved #729

@tomwhite

Description

@tomwhite

This was picked up in the array API tests: https://github.com/cubed-dev/cubed/actions/runs/15697743690/job/44226032553

AssertionError: out=0.0, but should be -0 [sin()]

Reproducer:

>>> import numpy as np
>>> a = np.array([0.0, -0.0])
>>> np.sin(a)
array([ 0., -0.])
>>> import cubed as xp
>>> b = xp.asarray(a)
>>> xp.sin(b).compute()
array([0., 0.])

With Zarr 2 it works:

>>> import numpy as np
>>> a = np.array([0.0, -0.0])
>>> np.sin(a)
array([ 0., -0.])
>>> import cubed as xp
>>> b = xp.asarray(a)
>>> xp.sin(b).compute()
array([ 0., -0.])

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions