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

fix: Converting a Double to BigDecimal can result in precision loss. #425

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

lkzc19
Copy link
Contributor

@lkzc19 lkzc19 commented Oct 18, 2023

BigDecimal(jp.doubleValue) can cause precision loss

@lkzc19
Copy link
Contributor Author

lkzc19 commented Oct 18, 2023

I encountered an issue while using KMongo. In MongoDB, a field is of type Double, but in Kotlin, it is of type BigDecimal. When retrieving the data, the value 0.13 becomes 0.130000000000000xxxxxxxx. After debugging, I realized that it seems to be a deserialization issue.

@lkzc19 lkzc19 changed the title Converting a Double to BigDecimal can result in precision loss. fix: Converting a Double to BigDecimal can result in precision loss. Oct 18, 2023
@zigzago
Copy link
Member

zigzago commented Oct 23, 2023

Thank you !

@zigzago zigzago merged commit 83542f2 into Litote:master Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants