Litote / kmongo

[deprecated] KMongo - a Kotlin toolkit for Mongo
https://litote.org/kmongo/
Apache License 2.0
781 stars 74 forks source link

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

Closed lkzc19 closed 1 year ago

lkzc19 commented 1 year ago

BigDecimal(jp.doubleValue) can cause precision loss

lkzc19 commented 1 year ago

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.

zigzago commented 1 year ago

Thank you !