Skip to content

NumberBigDecimalConverter uses improper BigDecimal constructor causing floating point error #771

@basme

Description

@basme

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions