From: "Peña, Botp" Date: 2003-06-24T18:17:43+09:00 Subject: Re: Decimal builtin? Holden Glova [mailto:dsafari@paradise.net.nz] wrote: > > > > what is http://www.rubycentral.com/book/ref_c_bignum.html > > > > or http://raa.ruby-lang.org/list.rhtml?name=bigfloat, no? > > > > > > Thanks for your reply Botp, but wouldn't this still be > susceptible > > > to rounding error? > > > > could you site an example so that our ruby friends/hackers can also > > help? > > > > > Signed, > > > Holden Glova > > > > kind regards -botp > > Actually funny you ask because I can't seem to make the float > class provide > rounding errors. I have been searching on the web but can't > seem to make Ruby > give me rounding errors. I was under the impressions that > floats where always > inaccurate, is this not the case in Ruby? The reason I ask is > because I am > working on a general Money class. Currently I am backing this > with a Fixnum > in cents, but would prefer to have some sort of decimal type > that doesn't put > a limit on 2 cent places. Very interesting indeed... ah, money matters (or rather cents matters ;-). I, too, am paranoid of cents and to _avoid_ them, I just do mult by 100 or 1000 (depends), then process, then go back by dividing by 100 or 1000... what is 100.00 divided by 3? In money/business matters, it could probably be 33.33 for each of the 3 and 0.01 for charity ;-) Of course, you can then make your own class for this.. in Ruby, the limit is the imagination :-) I think many have done their own classes for this kind of problem... just wait for some people's reply... > - -- > Signed, > Holden Glova kind regards -botp