On 24 December 2010 16:36, Marnen Laibow-Koser <[email protected]> wrote: > Colin Law wrote in post #970510: >> On 24 December 2010 14:47, Marnen Laibow-Koser <[email protected]> >> wrote: >>>> Talking slight bollocks. I meant that you can't store with infinite >>>> precision, ie you'll always be liable for some error. >>> >>> Of course. You know a better way? Should we just store everything as >>> Rational? >> >> For things that _are_ decimal numbers (such as money) use Fixed or >> BigDecimal and for things that are not decimal then use Float and >> determine the errors if it is important. > > That's basically what I've been saying, except for "decimal" substitute > "rational". However, there's not always an a priori way to determine if > a given field will need to store irrational numbers.
I am not quite sure that is that is the same as "never, ever use Floats for arithmetic" :) Also as we have seen for rational numbers like 1/3 BigDecimal is no better than float, except that it is possible to specify a smaller or larger precision than that which float supplies, and it is a decimal precision rather than a binary one. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

