[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Accuracy of floating point computation in MCL
- To: info-mcl
- Subject: Accuracy of floating point computation in MCL
- From: firstname.lastname@example.org (Michael Lewis)
- Date: 28 Nov 91 21:36:22 GMT
- Keywords: floating point, coercion
- Newsgroups: comp.lang.lisp.mcl
- Organization: University of Waterloo
- Sender: email@example.com (USENET News System)
There seems to be a pervasive and important error in floating point
calculations in MCL.
? (loop for i from 0.0 to 1.0 by 0.1 collect i)
(0.0 0.1 0.2 0.30000000000000004 0.4 0.5 0.6 0.7 0.7999999999999999 0.8999999999999999 0.9999999999999999)
? (- .3 3/10)
And my favourite is
? (> 3/10 .3)
Imagine the consequences!
Note however that
(- 1/2 .5) yields 0.0
(- 1/8 .125)
As our application here depends *critically* on *accurate*
numerical calculations we were wondering exactly how we could get MCL
to "do the right thing"!