Re: Floating point error?
On Oct 30, 2004, at 2:41 PM, Frank Buss wrote:
> which LispWorks version do you use? I can't reproduce it in LispWorks
> 4.3.7,
> Windows version.
LispWorks 4.3.7 running on OS X 10.3.5. Incidentally, MCL 5.0 gives the
correct answer on the same system.
> But your problem is a general problem, because not every decimal
> number can
> be expressed as a floating point number. If you are calculating with
> money,
> try using cents.
In this case, I am able to represent the quantities as integers.
However, while I certainly understand that there are limits to floating
point representation, it seems that LispWorks should be able to
adequately represent integer multiples of 0.02.
Comparing MCL to LispWorks, I find
LispWorks:
least-positive-single-float ==>1.4012985E-45
(float-precision 0.02) ==> 24
MCL 5.0:
least-positive-single-float ==> 5.0E-324
(float-precision 0.02) ==> 53
Are the LW settings different for PC and Mac? If so, is there a way to
adjust these values?
Thanks,
-Chris S