- Sep 10, 2001
- 11,711
- 8
- 81
The attached code produces the following output:
The second one should be 44.5 but the DecimalFormat class seems to be using the incredibly silly rounding rule of 'HALF_EVEN' which only rounds up on a 5 if the number to the left is odd. Anyway to change this default behavior or get around this without wiriting 10 lines of code to accomplish the same task?
55.6
44.4
The second one should be 44.5 but the DecimalFormat class seems to be using the incredibly silly rounding rule of 'HALF_EVEN' which only rounds up on a 5 if the number to the left is odd. Anyway to change this default behavior or get around this without wiriting 10 lines of code to accomplish the same task?