tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Casey" <patca...@adelphia.net>
Subject RE: Decimal rounding problems when working with currency.
Date Thu, 01 Sep 2005 21:41:46 GMT

	You could make it a ValidField and then write your own BigDecimal
validator to do the translation to and from strings, couldn't you?

	--- Pat

> -----Original Message-----
> From: Ted Steen [mailto:ted.steen@gmail.com]
> Sent: Thursday, September 01, 2005 2:40 PM
> To: Tapestry users
> Subject: Decimal rounding problems when working with currency.
> 
> Hi all!
> 
> I need to work with BigDecimal in order to represent decimal numbers
> with greater precision than float.
> 
> If I need to store the (float) number 27.9 in a BigDecimal it
> transforms into 27.89999999999999857891452847...
> 
> In tapestry I have my @TextField with translator:number
> tied to a property "public abstract BigDecimal getAmount();"
> problem is that tapestry seem to store 27.9 in a float (or maybe
> double) before storing it in the BigDecimal which mess up the number.
> :(
> 
> Now are there a translator for BigDecimal, should I write my own
> translator or should I re-thing the whole thing?
> 
> 
> --
> /ted
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Mime
View raw message