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

NumberBigDecimalConverter uses improper BigDecimal constructor causing floating point error #771

Open
basme opened this issue Dec 15, 2021 · 0 comments · May be fixed by #799
Open

NumberBigDecimalConverter uses improper BigDecimal constructor causing floating point error #771

basme opened this issue Dec 15, 2021 · 0 comments · May be fixed by #799

Comments

@basme
Copy link

basme commented Dec 15, 2021

NumberBigDecimalConverter class, when constructing a target BigDecimal instance, uses new BigDecimal(double) constructor which can cause floating point error, as described in constructor's javadoc.
Use case example: when used with jooq, this implementation causes unexpected behavior: numeric non-integer value stored in DB is presented in biased incorrect BigInteger value in target entity.

As per javadoc, it is recommended to use either BigDecimal(String) constructor or BigDecimal.valueOf(double) method.

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 a pull request may close this issue.

1 participant