From: Mark Probert Date: 2002-12-12T03:15:19+09:00 Subject: Re: Proper Type for Dollar Amount Hi, botp. At 10:25 AM 12/11/2002 +0900, you wrote: >Hmmm.. very clever/insightful, sir Mark. I'm putting your tip on my code >bank ;-) Scaled integers can be very handy in lots of situations. I guess that we have just got so used to having floating point available that we forget about what we lose. For example, using scaled integers you can represent 1/3, something that you can't do using (most) floating point representations. Interestingly, there are a bunch of rational approximations for irrationals that allow you to do more "serious" math using scaled integers: const ratio error ------ ----- ----- pi 355/113 8.5e-8 sqrt(2) 19601/13860 1.5e-9 sqrt(3) 18817/10864 1.1e-9 e 28667/10564 5.5e-9 c 24559/8192 1.6e-9 I haven't done any checks to see if this will make any difference to Ruby's performance. Regards, -mark.