You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "pitrou (via GitHub)" <gi...@apache.org> on 2023/06/06 13:12:00 UTC
[GitHub] [arrow] pitrou opened a new issue, #35942: [C++] Decimal-to-real accuracy loss / rounding issue
pitrou opened a new issue, #35942:
URL: https://github.com/apache/arrow/issues/35942
### Describe the bug, including details regarding any error messages, version, and platform.
It seems the expected result from converting a decimal to real may be off by one ULP:
```pycon
>>> a = pa.array(['999999999999999.9']).cast(pa.decimal128(17,1))
>>> a
<pyarrow.lib.Decimal128Array object at 0x7f8ec6f3f6a0>
[
999999999999999.9
]
>>> a.cast(pa.float64())
<pyarrow.lib.DoubleArray object at 0x7f8fa4a88ee0>
[
1e+15
]
>>> expected = 999999999999999.9
>>> actual = a.cast(pa.float64())[0].as_py()
>>> abs(expected-actual)/expected
1.25e-16
>>> abs(expected-actual) == expected - math.nextafter(expected, 0)
True # Exactly one ULP
```
This is much less sever
### Component(s)
C++
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou closed issue #35942: [C++] Decimal-to-real accuracy loss / rounding issue
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou closed issue #35942: [C++] Decimal-to-real accuracy loss / rounding issue
URL: https://github.com/apache/arrow/issues/35942
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] js8544 commented on issue #35942: [C++] Decimal-to-real accuracy loss / rounding issue
Posted by "js8544 (via GitHub)" <gi...@apache.org>.
js8544 commented on issue #35942:
URL: https://github.com/apache/arrow/issues/35942#issuecomment-1637631636
take
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org