From: Sam Goldman Date: 2004-10-30T23:38:52+09:00 Subject: Re: Money Class (was Re: Rounding error, (100.0 * 9.95).to_i == 994) And the subject takes up the whole first section of Test Driven Development by Kent Beck. - Sam (new to the list) Francis Hwang wrote: > > On Oct 30, 2004, at 9:05 AM, Brian Schr�der wrote: > >> Why not just use integer valued cent-counts? > > > Sometimes that's not sufficient. If you're an organization that has to > deal with quantities and amounts priced in multiple currencies, you have > to store both the number and the currency itself. 5 Euros, 10 dollars, > 42000 Korean won, etc. Then if you are adding or comparing them to one > another you have to figure out how to sensibly model that. What's 5 > Euros plus 10 dollars? Does it matter that the answer to that question > changes over time, as exchange rates are constantly fluctuating? > > It's a pretty interesting little domain. Martin Fowler devotes a few > pages to it in Analysis Patterns. > > F. > >