[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Accuracy of floating point computation in MCL
- To: info-mcl
- Subject: Re: Accuracy of floating point computation in MCL
- From: firstname.lastname@example.org (Michael Lewis)
- Date: 2 Dec 91 19:53:34 GMT
- Keywords: floating point, coercion
- Newsgroups: comp.lang.lisp.mcl
- Organization: University of Waterloo
- References: <1991Nov28.email@example.com>
- Sender: firstname.lastname@example.org (USENET News System)
In article <1991Nov28.email@example.com>, firstname.lastname@example.org (Michael Lewis) writes:
> There seems to be a pervasive and important error in floating point
> calculations in MCL.
To which I had some kind and gentle remarks and introductory essays on
floating point arithmetic. Thanks to those concerned but my point must
have been hidden in my message. Sorry.
The real import of my comment deals with floating point contagion in MCL.
From my previous message:
> ** stuff deleted **
> ? (- .3 3/10)
> And my favourite is
> ? (> 3/10 .3)
> Imagine the consequences!
The question is why isn't 3/10 coerced to the same representation as 0.3?
For example in Franz Common Lisp we have
<cl> (- .3 3/10)
<cl> (< 3/10 0.3)
<cl> (< .3 3/10)
Note also that in MCL 2.0 we have:
? (- .3 (/ (float 3) (float 10)))
? (float 3/10)
One person (jhowland%ariel.cs.trinity.edu) mentioned that J (a descendent
of APL) permits a user determined tolerance for arithmetic comparisons.
Has anyone done this in MCL? In general CL?
The following example was mentioned to show that when there is an exact
binary representation, things are ok.
> Note however that
> (- 1/2 .5) yields 0.0
> as does
> (- 1/8 .125)
So I repeat:
> As our application here depends *critically* on *accurate*
> numerical calculations we were wondering exactly how we could get MCL
> to "do the right thing"!
Thanks in advance for your comments.