Skip to content

expm1 returns wrong result for -0 + 0 j on CPU #2244

@antonwolfy

Description

@antonwolfy

The following example breaks Python array API:

import dpctl, dpctl.tensor as dpt

dpctl.__version__
# Out: '0.22.0dev0+114.g0797836be2'

a = dpt.asarray(complex(-0.0, 0.0), device='cpu')
dpt.expm1(a)
# Out: usm_ndarray(-0.+0.j)

# on GPU the result is expected:
a = dpt.asarray(complex(-0.0, 0.0), device='gpu')
dpt.expm1(a)
# Out: usm_ndarray(0.+0.j)

According to the spec:

If a is either +0 or -0 and b is +0, the result is 0 + 0j

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions