Skip to content

[C++] Decimal{128,256}::FromReal accuracy loss on non-small scale values #35576

@wirable23

Description

@wirable23

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

a = pa.array([545803904.0], type=pa.float32())
>>> a.cast(pa.decimal128(38, 18))
<pyarrow.lib.Decimal128Array object at 0x000001DE8FF59840>
[
  545803886.966396699654750208
]
>>>

While encoding of decimal128 and float32 is very different, the difference after the cast seems much larger than expected.

Component(s)

Python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions