From: "Peña, Botp" Date: 2002-12-11T10:25:29+09:00 Subject: Re: Proper Type for Dollar Amount Hi Mark (aka Mark Probert [mailto:probertm@nortelnetworks.com]): You enlightened last Wednesday, December 11, 2002 2:46 AM: > > My own experience (based on developing real-time trading > systems for some merchant banks), is that the best solution > is to use scaled integers, to 100th of a cent. So, $154.34 > --> 1543400. You then get very fast operations (they are all > integer operations) and, in general, well with +- 4 billion. > Ruby, with BigInt makes it trivial. Hmmm.. very clever/insightful, sir Mark. I'm putting your tip on my code bank ;-) C:\family\ruby>type a1.rb def t (2.4)/(0.2) end x = t p x p x.truncate C:\family\ruby>ruby a1.rb 12 11 C:\family\ruby>type a1.rb def t (2.4*100)/(0.2*100) end x = t p x p x.truncate C:\family\ruby>ruby a1.rb 12.0 12 I do not get truncation problems :-) > Regards, > -mark. Kind regards, -botp