L
laredotornado
Hi,
I'm using Java 1.6. BigDecimal division seems to be rounding to the
tenths decimal place and I would prefer it round to the hundredths
decimal place. I have
final BigDecimal avgRate = sum.divide(totalDays,
BigDecimal.ROUND_HALF_EVEN);
If totalDays is 6, and sum is 634, the result above is giving me
105.7, but ideally, I would want 105.67 (since the result is
105.666667). Any ideas how to adjust the division above to get the
result I want?
Thanks, - Dave
I'm using Java 1.6. BigDecimal division seems to be rounding to the
tenths decimal place and I would prefer it round to the hundredths
decimal place. I have
final BigDecimal avgRate = sum.divide(totalDays,
BigDecimal.ROUND_HALF_EVEN);
If totalDays is 6, and sum is 634, the result above is giving me
105.7, but ideally, I would want 105.67 (since the result is
105.666667). Any ideas how to adjust the division above to get the
result I want?
Thanks, - Dave