Reputation: 2526
Here is an example:
<h:outputText value="#{myBean.myMoney}">
<f:convertNumber type="currency" currencySymbol="$" />
</h:outputText>
Given that I have $1.006, will this output $1.00 or $1.01?
Doesn't say here: http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/tlddocs/f/convertNumber.html
Upvotes: 4
Views: 10720
Reputation: 2526
Answer=Rounded
Hmmm....does that sound right? I don't think its a good idea to be rounding up money. Hopefully no banking apps are going to rely on this one.
Brings to mind this scene from One Flew Over the Cuckoo's Nest...
[the inmates are playing cards and betting with cigarettes]
Martini: [rips a cigarette in half] I bet a nickel.
McMurphy: Dime's the limit, Martini.
Martini: I bet a dime.
[Puts the two halves onto the table]
McMurphy: This is not a dime, Martini. This is a dime.
[shows a whole cigarette]
McMurphy: If you break it in half, you don't get two nickels, you get shit. Try and smoke it. You understand?
Martini: Yes.
McMurphy: You don't understand.
Upvotes: 6
Reputation: 39374
Currency can be set only to 2 decimal places, setting it to more than 2 decimal places is wrong. If the input is with more than 2 decimal places the output would be truncated to 2 decimal places.
Logically $1.001 would not make any sense as $1 and 1 cent would be $1.01 not $1.001.
Upvotes: 1