fusdahl
04/20/2018, 10:33 AM/
to divide big decimals the outcome is kind of unexpected:
40.toBigDecimal() / 100.toBigDecimal()
0
40.toBigDecimal().divide(100.toBigDecimal())
0.4
This seems to be a result of /
using the half even rounding mode.
Does anyone know why this rounding mode was chosen?ilya.gorbunov
04/20/2018, 3:14 PMdivide
throws ArithmeticException
if it can't represent the result exactly. That's why we use rounding.