Okay, I (finally) agree with you. Thanks for the explanations.
Mark
-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 1:35 PM
To: Struts Users Mailing List
Subject: RE: Bean Bug?
Mark,
Regardless of how the number is formatted, there will
The java.math.BigDecimal class gives its user complete control over rounding
behavior.
Mark
-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 1:57 PM
To: Struts Users Mailing List
Subject: RE: Bean Bug?
Chandra,
I think the point I am trying
ind of formatting. I think this is what Mark is asking about.
>
>-Original Message-
>From: Richard Yee [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, May 01, 2002 12:35 PM
>To: Struts Users Mailing List
>Subject: RE: Bean Bug?
>
>
>Mark,
>Regardless of how the n
kind of formatting. I think this is what Mark is asking about.
-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 12:35 PM
To: Struts Users Mailing List
Subject: RE: Bean Bug?
Mark,
Regardless of how the number is formatted, there will always be a
Mark,
Regardless of how the number is formatted, there will always be a problem
when handling currency amounts as floating numbers. Multiplication and
division operations will introduce rounding errors. I have found that it is
best to store currency amounts as ints and then have code in the bea
I see your point, but aren't you incurring unnecessary formatting overhead
in the presentation tier (to say nothing of ongoing maintenance)? Any
Struts tag that writes to the presentation tier should take such formatting
issues into consideration. For example, the formatting tag that Chandras
su
t; <[EMAIL PROTECTED]>
To:"'Struts Users Mailing List'" <[EMAIL PROTECTED]>
cc:
Subject:RE: Bean Bug?
I'd be interested in how you can use ints for decimal numbers. The "right"
way is to use BIG_DECIMAL, but I have to use the session bean met
Mark,
In continuing with my last email. 1.00 would be stored as 100 in an int.
-Richard
At 03:52 PM 4/30/2002 -0700, you wrote:
>Mark,
>To store decimal numbers or any currency for that matter as ints, you
>store the values as the smallest unit of currency. For dollars, this is
>0.01 or a cent
Mark,
To store decimal numbers or any currency for that matter as ints, you store
the values as the smallest unit of currency. For dollars, this is 0.01 or
a cent. You then can avoid any round off errors when doing multiplication
or division.
Regards,
Richard
At 06:15 PM 4/30/2002 -0400, yo
, Mark [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 5:15 PM
To: 'Struts Users Mailing List'
Subject: RE: Bean Bug?
I'd be interested in how you can use ints for decimal numbers. The "right"
way is to use BIG_DECIMAL, but I have to use the session bean method
Thanks - I'll give it a whirl.
-Original Message-
From: Otavio Decio [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:38 PM
To: Struts Users Mailing List
Subject: Re: Bean Bug?
Don't know if this is your problem, but try to put the following in your
reso
Maybe not the best approach but I'd add another form bean field as a
String called "priceDisplay"
Then in the setPrice(float f) method you'd call setPriceDisplay(float
f)
setPriceDisplay( float money ) {
DecimalFormat df = (DecimalFormat)NumberFormat.getCurrencyInstance();
df.setN
;" <[EMAIL PROTECTED]>
Sent: Tuesday, April 30, 2002 6:15 PM
Subject: RE: Bean Bug?
> I'd be interested in how you can use ints for decimal numbers. The
"right"
> way is to use BIG_DECIMAL, but I have to use the session bean method given
> me for my bean data.
I'd be interested in how you can use ints for decimal numbers. The "right"
way is to use BIG_DECIMAL, but I have to use the session bean method given
me for my bean data. But this still does not address the issue of the
behavior.
Mark
-Original Message-
From: Micael Padraig Og mac Gre
First Principle of Economics: ever use float or double for money. Use
ints. Or, for serious money, longs. 'The real problem is not the "output"
but the whole idea.
micael
At 05:56 PM 4/30/02 -0400, you wrote:
>I'm using a simple which grabs
>a float price from the form bean. The display,
15 matches
Mail list logo