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

division decimal: lose precision when convert i128 to f64 #2259

Closed
liukun4515 opened this issue Apr 18, 2022 · 3 comments
Closed

division decimal: lose precision when convert i128 to f64 #2259

liukun4515 opened this issue Apr 18, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@liukun4515
Copy link
Contributor

But now I find a bug in the arithmetic operation. https://github.com/apache/arrow-datafusion/blob/c91efc27658e58264c4f346a5cfdec8810179e90/datafusion/physical-expr/src/expressions/binary.rs#L302 and https://github.com/apache/arrow-datafusion/blob/c91efc27658e58264c4f346a5cfdec8810179e90/datafusion/physical-expr/src/expressions/binary.rs#L307

In the divide method, we may lose of precision by converting the i128 to f64.
We use the f64 to store the larger range of data, but we lose the precision.

I will try to figure out this issue and resolve this.

Originally posted by @liukun4515 in #2233 (comment)

@liukun4515
Copy link
Contributor Author

related to #122

@liukun4515 liukun4515 self-assigned this Jul 4, 2022
@liukun4515 liukun4515 added the bug Something isn't working label Jul 4, 2022
@andygrove andygrove added this to the 14.0.0 milestone Oct 30, 2022
@andygrove andygrove removed this from the 14.0.0 milestone Nov 1, 2022
@alamb
Copy link
Contributor

alamb commented Jul 17, 2023

I wonder if this is now completed 🤔

@viirya
Copy link
Member

viirya commented Jul 17, 2023

I think the code using f64 for decimal division is out-of-dated for a while. We are using i128 directly to process it. That being said I don't expect this is still an issue.

@alamb alamb closed this as completed Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants