Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Improve Decimal32 conversion from Real #44216

Open
zeroshade opened this issue Sep 24, 2024 · 0 comments
Open

[C++] Improve Decimal32 conversion from Real #44216

zeroshade opened this issue Sep 24, 2024 · 0 comments

Comments

@zeroshade
Copy link
Member

Describe the enhancement requested

Currently, to avoid precision and rounding differences, we unconditionally push FromPositiveReal for Decimal32 to use the approximate algorithm. This is because the iterative multiply/divide paths result in losing a few bits that causes an off-by-one issue with Decimal32 values at the edges (or close to) the max precision of it.

A possible solution might be to convert to Decimal64 and then convert back down to Decimal32 afterwards, though it might still have rounding issues.

Overall, while using the approx algorithm isn't bad, we can probably do better and should look into improving it.

Component(s)

C++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant