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, 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 beans to 
format the values for display. This also can ease I18n issues when dealing 
with currencies that don't contain decimals.

Regards,

Richard



At 06:22 AM 5/1/2002 -0400, you wrote:
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
suggests (or using java.text.NumberFormat in the action) look like good
solutions.

Mark

-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:55 PM

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. You then can avoid any round off errors when doing
 multiplication or division.
 
 Regards,
 
 Richard

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Bean Bug?

2002-05-01 Thread Peter Pilgrim



(1) Use BigDecimal for all financial currency amounts
(2) Write your own Custom Tag to print out monetary data.

It is easy to subclass org.apache.struts.taglib.bean.WriteTag
to provide a custom tag similar to

acme:numberFormat  format=#,###.00(#,###.00)  name=obj property=moneyAttr /

--
Peter Pilgrim   ++44 (0)207-545-9923

 Swamped under electronic mails


 Message History 



From:  Galbreath, Mark [EMAIL PROTECTED] on 30/04/2002 18:15 AST

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 for my bean data.  But this still does not address the issue of the
bean:write behavior.

Mark

-Original Message-
From: Micael Padraig Og mac Grene [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:00 PM

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 from the form bean.  The display, however, is unpredictable.
For a price of 25.00, e.g., can get returns of 25.00, 25.0 and 25.
Anybody else experiencing this behavior?  I've had to wrap the bean:write
with JavaScript to get the formatting correct.

Mark
De recta non tolerandum sunt.




--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]






--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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
suggests (or using java.text.NumberFormat in the action) look like good
solutions.

Mark

-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:55 PM

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. You then can avoid any round off errors when doing 
multiplication or division.

Regards,

Richard

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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 beans to 
format the values for display. This also can ease I18n issues when dealing 
with currencies that don't contain decimals.

Regards,

Richard



At 06:22 AM 5/1/2002 -0400, you wrote:
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
suggests (or using java.text.NumberFormat in the action) look like good
solutions.

Mark

-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:55 PM

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. You then can avoid any round off errors when doing
 multiplication or division.
 
 Regards,
 
 Richard

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Bean Bug?

2002-05-01 Thread Jakkampudi, ChandraseKhar

I would think (hope, rather) that calculations are not being performed in
the form beans. While you are correct about rounding errors, this has
nothing to do with display beans(for want of a better word) For example,
reading a float/double value from a database and displaying it requires 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 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 beans to 
format the values for display. This also can ease I18n issues when dealing 
with currencies that don't contain decimals.

Regards,

Richard



At 06:22 AM 5/1/2002 -0400, you wrote:
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
suggests (or using java.text.NumberFormat in the action) look like good
solutions.

Mark

-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:55 PM

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. You then can avoid any round off errors when doing
 multiplication or division.
 
 Regards,
 
 Richard

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Bean Bug?

2002-05-01 Thread Richard Yee

Chandra,
I think the point I am trying to make is that if you store amounts as 
integers in the database, you can avoid a lot of problems with rounding 
errors and the code that is necessary to avoid them in your business logic. 
I have had to add a lot of code to deal with the removal of fractional 
cents every time a multiplication or division operation is done on a value 
and when storing amounts. I've found that its easier just to store the 
amount as an integer and deal with the formatting when displaying the value.

-Richard

At 12:40 PM 5/1/2002 -0500, you wrote:
I would think (hope, rather) that calculations are not being performed in
the form beans. While you are correct about rounding errors, this has
nothing to do with display beans(for want of a better word) For example,
reading a float/double value from a database and displaying it requires 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 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 beans to
format the values for display. This also can ease I18n issues when dealing
with currencies that don't contain decimals.

Regards,

Richard



At 06:22 AM 5/1/2002 -0400, you wrote:
 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
 suggests (or using java.text.NumberFormat in the action) look like good
 solutions.
 
 Mark
 
 -Original Message-
 From: Richard Yee [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 30, 2002 6:55 PM
 
 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. You then can avoid any round off errors when doing
  multiplication or division.
  
  Regards,
  
  Richard
 
 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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 to make is that if you store amounts as 
integers in the database, you can avoid a lot of problems with rounding 
errors and the code that is necessary to avoid them in your business logic. 
I have had to add a lot of code to deal with the removal of fractional 
cents every time a multiplication or division operation is done on a value 
and when storing amounts. I've found that its easier just to store the 
amount as an integer and deal with the formatting when displaying the value.

-Richard

At 12:40 PM 5/1/2002 -0500, you wrote:
I would think (hope, rather) that calculations are not being performed in
the form beans. While you are correct about rounding errors, this has
nothing to do with display beans(for want of a better word) For example,
reading a float/double value from a database and displaying it requires
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 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 beans to
format the values for display. This also can ease I18n issues when dealing
with currencies that don't contain decimals.

Regards,

Richard



At 06:22 AM 5/1/2002 -0400, you wrote:
 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
 suggests (or using java.text.NumberFormat in the action) look like good
 solutions.
 
 Mark
 
 -Original Message-
 From: Richard Yee [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 30, 2002 6:55 PM
 
 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. You then can avoid any round off errors when doing
  multiplication or division.
  
  Regards,
  
  Richard
 
 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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 from the form bean.  The display, however, is unpredictable.
For a price of 25.00, e.g., can get returns of 25.00, 25.0 and 25.
Anybody else experiencing this behavior?  I've had to wrap the bean:write
with JavaScript to get the formatting correct.

Mark
De recta non tolerandum sunt.




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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 Og mac Grene [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:00 PM

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 from the form bean.  The display, however, is unpredictable.
For a price of 25.00, e.g., can get returns of 25.00, 25.0 and 25.
Anybody else experiencing this behavior?  I've had to wrap the bean:write
with JavaScript to get the formatting correct.

Mark
De recta non tolerandum sunt.




--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Bean Bug?

2002-04-30 Thread Otavio Decio

Don't know if this is your problem, but try to put the following in your
resources file:

org.apache.struts.taglib.bean.format.float=#,###.##

Otavio

- Original Message -
From: Galbreath, Mark [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [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.  But this still does not address the issue of the
 bean:write behavior.

 Mark

 -Original Message-
 From: Micael Padraig Og mac Grene [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 30, 2002 6:00 PM

 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 from the form bean.  The display, however, is
unpredictable.
 For a price of 25.00, e.g., can get returns of 25.00, 25.0 and 25.
 Anybody else experiencing this behavior?  I've had to wrap the
bean:write
 with JavaScript to get the formatting correct.
 
 Mark
 De recta non tolerandum sunt.
 



 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]

 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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();
df.setNegativePrefix(-);
df.setNegativeSuffix(); 
priceDisplay = df.format(money);
}

then of course a getter to return the String priceDisplay which you
would use in the bean:write tag.


On Tuesday, April 30, 2002, 5:56:24 PM, Mark wrote:

GM I'm using a simple bean:write name=phone property=price /
GM which grabs a float price from the form bean.  The display,
GM however, is unpredictable. For a price of 25.00, e.g., can get
GM returns of 25.00, 25.0 and 25. Anybody else experiencing
GM this behavior?  I've had to wrap the bean:write with JavaScript
GM to get the formatting correct.
 
GM Mark
GM De recta non tolerandum sunt.
 


-- 

Rick
mailto:[EMAIL PROTECTED]

Any man, in the right situation, is capable of murder. But not any
man is capable of being a good camper. So, murder and camping are not
as similar as you might think. 
  -Jack Handey


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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:

org.apache.struts.taglib.bean.format.float=#,###.##

Otavio

- Original Message -
From: Galbreath, Mark [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [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.  But this still does not address the issue of the
 bean:write behavior.

 Mark

 -Original Message-
 From: Micael Padraig Og mac Grene [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 30, 2002 6:00 PM

 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 from the form bean.  The display, however, is
unpredictable.
 For a price of 25.00, e.g., can get returns of 25.00, 25.0 and 25.
 Anybody else experiencing this behavior?  I've had to wrap the
bean:write
 with JavaScript to get the formatting correct.
 
 Mark
 De recta non tolerandum sunt.
 



 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]

 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Bean Bug?

2002-04-30 Thread Jakkampudi, ChandraseKhar

I used a taglibrary I found on the web to format currency etc. 
http://coldjava.hypermart.net/servlets/numtag.htm


Alternatively, you can format them as Strings in the Action (if it is for a
form bean) using the java.text.NumberFormat classes

HTH
JC

-Original Message-
From: Galbreath, 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.  But this still does not address the issue of the
bean:write behavior.

Mark

-Original Message-
From: Micael Padraig Og mac Grene [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:00 PM

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 from the form bean.  The display, however, is unpredictable.
For a price of 25.00, e.g., can get returns of 25.00, 25.0 and 25.
Anybody else experiencing this behavior?  I've had to wrap the bean:write
with JavaScript to get the formatting correct.

Mark
De recta non tolerandum sunt.




--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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, you wrote:
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 Og mac Grene [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:00 PM

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 from the form bean.  The display, however, is unpredictable.
 For a price of 25.00, e.g., can get returns of 25.00, 25.0 and 25.
 Anybody else experiencing this behavior?  I've had to wrap the bean:write
 with JavaScript to get the formatting correct.
 
 Mark
 De recta non tolerandum sunt.
 



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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. You then can avoid any round off errors when doing 
multiplication or division.

Regards,

Richard

At 06:15 PM 4/30/2002 -0400, you wrote:
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 Og mac Grene [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 6:00 PM

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 from the form bean.  The display, however, is unpredictable.
 For a price of 25.00, e.g., can get returns of 25.00, 25.0 and 25.
 Anybody else experiencing this behavior?  I've had to wrap the bean:write
 with JavaScript to get the formatting correct.
 
 Mark
 De recta non tolerandum sunt.
 



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]