Skip to content

[C++] power_checked incorrectly returns NaN #36602

@rohanjain101

Description

@rohanjain101

Describe the bug, including details regarding any error messages, version, and platform.

>>> a = pa.array([-117], type=pa.int8())
>>> b = pa.array([7], type=pa.decimal128(38,18))
>>> pa.compute.power_checked(a, b)
<pyarrow.lib.DoubleArray object at 0x000001F398AF9F00>
[
  nan
]
>>>

I would expect this to return -300124211606973, not NaN. If B is re-scaled, then it returns correct result:

>>> b = pa.array([7], type=pa.decimal128(3,2))
>>> pa.compute.power_checked(a, b)
<pyarrow.lib.DoubleArray object at 0x000001F398AF8DC0>
[
  -3.00124211606973e+14
]
>>>

Component(s)

Python

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