I can clarify that a little bit: it's not that you want to get arbitrarily *large* values in your form (though maybe Gill's app requires that), but rather that float and double are not precise, and when you do a bunch of consecutive operations on them, you can get rounding errors that add up to real money.

Yeah, I knew that, by "an arbitrary amount of money" I meant that users could enter an arbitrary amount of money. The applications I've written mostly just let people select items and the price is kept on the server-side.

The basic problem is that "1300.5" may, if you look at the underlying representation, *really* be "1300.50000000001", or worse, "1300.499999999999". BigDecimal is a precise representation. And it allows you to explicitly specify how you want rounding to be handled, which is important in financial applications.

My approach so far has been to use "long" as the database representation (representing a whole number of the smallest unit of currency) and provide accessors to automatically convert to/from BigDecimal. But that is far from an ideal solution and direct BigDecimal support would be great.

Hereby is your wish and Gill's wish granted. I just committed BigDecimal support and it should thus show up in the next nighty build. If you rely on RIFE to create your database tables, make sure that you set the proper precision and scale constraint on the BigDecimal property.

Take care,

Geert


--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to