Menu

#62 enable RoundingMode for number formats

2.3.24
closed-fixed
nobody
None
5
2016-05-21
2009-01-13
Brian Nahas
No

In Java 1.6, setRoundingMode was added to DecimalFormat. FreeMarker should expose this as a setting in the Configuration/Environment so that the rounding mode can be adjusted for decimal formats (HALF_UP in our case).

This problem was discussed previously on the mailing list at http://www.nabble.com/Change-rounding-mode-td19990183.html and we just ran into it as well when a customer complained about a 2.5 being rounded down.

Discussion

  • Dániel Dékány

    Yeah, surely a missing thing. But that's a feature request, not a bug -- moved it over.

     
  • Dániel Dékány

    • labels: 1040385 -->
     
  • Dániel Dékány

    As of 2.3.24 you can specify pretty much all DecimalFormat options in the pattern string, in the 3rd ;-separated section. For example, you can change the rounding mode to half-up: "0.###;; roundingMode=halfUp".

     

    Last edit: Dániel Dékány 2016-05-21
  • Dániel Dékány

    • Group: --> 2.3.24
     
  • Dániel Dékány

    • status: open --> closed-fixed
     

Log in to post a comment.