Colin Law wrote in post #970523: > On 24 December 2010 16:36, Marnen Laibow-Koser <[email protected]> > wrote: >>> 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" :)
Oh, now I see the difference. Even if I store something as a Float, I'd probably use BigDecimal for arithmetic. I simply don't believe that Float arithmetic has any place at all in a wise programmer's repertoire. Consider it the 21st-century goto, if you like. :) > > 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, That makes it better than Float right there. Also, you don't accumulate any *more* error. > and it is a decimal > precision rather than a binary one. ...which is not generally better or worse. > > Colin Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- 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.

