From: "Andreas S." Date: 2005-12-13T09:16:04+09:00 Subject: Re: Using Float For Currency unknown wrote: > Quoting Hunter's Lists : > >> Howdy, >> >> I have some methods that manipulate floats that represent a >> currency amount. >> >> I often end up with more precision than I need, i.e.: $9.756. >> >> What is the best way to scale that to 9.76? > > If you're doing anything that matters, don't use floats for > currency. There are a lot of really nasty subtle issues that will > lose money between the cracks. > > Usually you want a specialized currency type which uses > fixed-precision arithmetic. BigDecimal is good. -- Posted via http://www.ruby-forum.com/.