Stefan Evans wrote:The answer can be found in the Java API for java.math.RoundingMode.
It's buried very deeply in there, then. Searching for the word "default" fails, as does the word "standard". Reading the whole thing from start to finish eventually leads to an obscure paragraph which says that one of the rounding modes is "analogous to the rounding policy used for float and double arithmetic in Java". Googling for "java float rounding policy" leads to the RoundingMode API documentation and to a horrid roseindia "tutorial" but not to any document which tells you that Java does have a rounding policy and what it is.
I spent some time earlier today trying to figure out JSTL's rounding rules with no success. Earlier JSTL specs don't even mention rounding, and later versions just say that it takes place, but not how. I also searched some of the Java API like NumberFormat on the theory that Java might have a default rounding rule. Still no success. And I consider myself to be pretty good at finding information if it's in online documentation. So I gave up and left the question unanswered. I would have to say, though, that it's a much harder question than it should be.
NumberFormat was close... I actually found the answer in java.text.DecimalFormat, which is what led me to the java.match.RoundingMode class. DecimalFormat is mentioned in the pattern part of the JSTL 1.2 spec I was reading, so I figured it would also apply.
I guess I skipped all my logic/search on the way by providing the direct link, and also wanting to make use of the shiny forum feature that automatically replaces java class names with links to the API.
Anyway quoting from the java.text.DecimalFormat class:
DecimalFormat provides rounding modes defined in RoundingMode for formatting. By default, it uses RoundingMode.HALF_EVEN.
Not the easiest thing to find, but it is there :-)