zeroshade opened a new issue, #1518:
URL: https://github.com/apache/arrow-go/issues/1518
### Describe the bug, including details regarding any error messages,
version, and platform.
`FromString` for all four decimal widths parses the string into a
`big.Float` before scaling and rounding. Exact decimal halfway values often
aren't exactly representable in binary, so they land just above or just below
one half, and the result depends on that error rather than on a consistent
rounding rule.
On main (`78af17d3`, macOS arm64):
```go
decimal128.FromString("0.35", 38, 1) // 3
decimal128.FromString("0.15", 38, 1) // 2
decimal128.FromString("2.675", 38, 1) // 27
```
`0.35` rounds down while `0.15` rounds up, so these results match neither
half-up nor half-even rounding.
Expected: a consistent rule applied to the decimal value as written, for
example half away from zero, giving 4, 2 and 27, or half to even, giving 4, 2
and 27.
A fix would need to resolve ties from the decimal digits rather than the
binary approximation, while keeping the allocation bounds added for very large
and very small exponents. It changes results for values that are currently in
range, so it should be called out.
### Component(s)
Other
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]