myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mitroiasi <mitroi...@yahoo.com>
Subject BigDecimal or Double
Date Wed, 29 Apr 2009 07:52:00 GMT


Hi,

I have some input fields which should accept only numbers with 2 decimals.
My question is: Which is better to use - BigDecimal or Double?
I know that for financial application it is better to use BigDecimal types
for the computation.

I have tried both in my application and I will explain what happens:
When I use Double, the following line of code works:
<f:convertNumber pattern="###,###,###,##0.00" minIntegerDigits="1"
maxIntegerDigits="12" maxFractionDigits="2" />

When I use BigDecimal I must use the old converter:
<s:convertNumber pattern="###,###,###,##0.00" minIntegerDigits="1"
maxIntegerDigits="12" maxFractionDigits="2" />, but then the input field
react strange. I try to insert one number and when I insert a comma, the
comma is shown before number. If I continue inserting the decimals, the
entire number is shown correctly.

Another problem of mine is the fact that before I have used in my
application int and double. As i said before the convertNumber works for
double, but it doesn't work for int.

Which is the best approach?
BigDecimal or double?
BigDecimal or Number or int?


-- 
View this message in context: http://www.nabble.com/BigDecimal-or-Double-tp23292320p23292320.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message