From: "Michael W. Ryder" <_mwryder@...> Date: 2007-06-23T04:15:01+09:00 Subject: Re: Ruby doesn't know how to multiply Daniel DeLorme wrote: > Michael W. Ryder wrote: >> I think we have a difference of understanding of what fixed point >> means. I look at fixed point numbers meaning something like 1057 >> means 10.57 in the real world. I was thinking more of something that >> shifted the floating point number to remove the fractions and later >> replaced the decimal point in the correct position, which I do not >> consider to be fixed point math. > > Basically you are thinking of > >> require "rational" > => true > >> Rational(1057,100).to_f > => 10.57 > > Daniel > I have been using Business Basic for over 25 years and it is what I consider fixed point. For example, entering 'Print 14.95*.6' results in 8.97. The language uses a set precision which can be changed. For example if I tell it to print 120*.000003 with the default precision of 2 it displays 0. If I change the precision to 6 and tell it to print the same thing it displays .00036. The computer stores the result in the precision at the time of the operation so entering 'a=120*.000003' in precision 2 stores 0 in a. Changing the precision to 6 afterwards still shows that 0 is stored in a. This is not like Ruby using printf where different formats show different results.