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

Clarify/Fix NumberValue calculation for conversions #168

Closed
atsticks opened this issue Jul 28, 2017 · 0 comments
Closed

Clarify/Fix NumberValue calculation for conversions #168

atsticks opened this issue Jul 28, 2017 · 0 comments
Assignees
Milestone

Comments

@atsticks
Copy link
Member

atsticks commented Jul 28, 2017

IMO the current number value used as round factor does not honor any MathContext/capabilities of the target amount:

In spi.AbstractCurrencyConversion:

protected NumberValue roundFactor(MonetaryAmount amount, NumberValue factor) should optionally round the factor to be used. By default this method will only round

  • as much as it is needed, so the factor can be handled by the target amount instance based on its
  • numeric capabilities. Rounding is applied only if amount.getContext().getMaxScale() > 0 as follows:
    • If the amount provides a MathContext as context property this is used.
    • If the amount provides a RoundingMode, this is used (default is RoundingMode.HALF_EVEN).
    • By default the scale used is scale of the conversion factor. If the acmount allows a higher scale based on amount.getContext().getMaxScale(), this higher scale is used.

Please leave your comments, if this should create any problems. You may also test the changes done with the latest master version of the repo.

@atsticks atsticks added this to the 1.2 milestone Jul 28, 2017
@atsticks atsticks self-assigned this Jul 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant