RE: Bean Bug?

2002-05-02 Thread Galbreath, Mark
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

RE: Bean Bug?

2002-05-01 Thread Peter Pilgrim
Please respond to Struts Users Mailing List [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 method given me

RE: Bean Bug?

2002-05-01 Thread Galbreath, Mark
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

RE: Bean Bug?

2002-05-01 Thread Richard Yee
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

RE: Bean Bug?

2002-05-01 Thread Jakkampudi, ChandraseKhar
this 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

RE: Bean Bug?

2002-05-01 Thread Richard Yee
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 problem when handling

RE: Bean Bug?

2002-05-01 Thread Galbreath, Mark
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

Re: Bean Bug?

2002-04-30 Thread Micael Padraig Og mac Grene
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 bean:write name=phone property=price / which grabs a float price

RE: Bean Bug?

2002-04-30 Thread Galbreath, Mark
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 bean:write behavior. Mark -Original Message- From: Micael Padraig

Re: Bean Bug?

2002-04-30 Thread Otavio Decio
, 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. But this still does not address the issue of the bean:write behavior. Mark

Re: Bean Bug?

2002-04-30 Thread Rick Reumann
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();

RE: Bean Bug?

2002-04-30 Thread Galbreath, Mark
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 resources file

RE: Bean Bug?

2002-04-30 Thread Jakkampudi, ChandraseKhar
, 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 given me for my bean data

RE: Bean Bug?

2002-04-30 Thread Richard Yee
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,

RE: Bean Bug?

2002-04-30 Thread Richard Yee
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.