Skip to content

Issues with floating point precision with monetary values #21

@Quik2007

Description

@Quik2007

If you disable all taxes etc. and just try to buy e.g. 8 stacks of stone at default config price and then sell it again you would expect to have the same balance afterwards, but actually there is 0.01$ difference due to "rounding"/imprecision with saving numbers as floats.

My suggestion for a fix would be to switch to java.math.BigDecimal instead of float for monetary values, as Decimal objects are common for financial applications (which this is, kinda :D)

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