Open jurriaan opened 8 months ago
Is that property documented anywhere? As far as I can tell, the spec compliant way to get a rounding with a client defined rounding mode is:
RoundingQueryBuilder.of()
.set(RoundingMode.class, RoundingMode.HALF_Up)
.build();
Edit: Just looked at org.javamoney.moneta.Money.defaults.roundingMode
. This should only affect rounding when Money
instances are used, and even then it's only used when the result of an operation exceeds the precision.
I've set the
org.javamoney.moneta.Money.defaults.roundingMode
property toHALF_UP
but noticed that the rounding usingMonetary.getDefaultRounding()
still usedHALF_EVEN
when rounding.I think this is due to the DefaultRoundingProvider having the default roundingMode set to
HALF_EVEN
instead of using the configuration.See: https://github.com/JavaMoney/jsr354-ri/blob/3415a66a09326f8e8bf07c21213b4d7eb4cf561a/moneta-core/src/main/java/org/javamoney/moneta/spi/DefaultRoundingProvider.java#L59
Is this expected behavior?