From: Todd Benson Date: 2007-07-17T21:12:48+09:00 Subject: Re: Force calculation result to BigDecimal On 7/17/07, Robert Klemme wrote: > Hm.... I don't think this is a fix because once you have a float you > lost all the precision. Can you elaborate on this? I was under the impression that converting to BigDecimal before arithmetic operations would get around this. Using class Float def big; BigDecimal(self.to_s); end end irb > Math::PI.big * 2.0 => 6.283185307178 irb > Math::PI.big * 2.0.big => # > A better fix is probably to change #coerce to > work properly. Another solution is to make sure all values are > converted to BD before starting the calculation. This would be the best solution (maybe through #induced_from?), but I don't know how to do it. > Note, that BigDecimal is returned when working with integers. Todd