From: Vadim V. Z. <vv...@ya...> - 2002-10-07 20:16:36
|
Sam Steingold write: >>* In message <3DA...@ma...> >>* On the subject of "Re: [clisp-list] floating point problems with clisp 2.30" >>* Sent on Sun, 06 Oct 2002 22:53:50 +0300 >>* Honorable "Vadim V. Zhytnikov" <vv...@ma...> writes: >> >>Unfortunately this doesn't explain wrong numeric values which I get >>for some special functions in Maxima with clisp 2.30 since the value >>above is correct. >> >> > >note that BESSEL &co call explicit (FLOAT * 1.0) which can easily >result in floating point contagion. > >again, _please_ supply me with an test example where a CLISP built-in >function produces incorrect results (either WRT precision, of value or >whatever). > > > Unfortunately I can't provide any simple example yet but below are results which make me think that something is wrong with clisp 2.30 or at least something is wrong in combination Maxima + clisp 2.30. All results are obtained on different lisps with Maxima CVS (SourceForge): ------------------------------------------------- CMUCL 18d (C1) gamma(1.1); (D1) .9513507698668733 ------------------------------------------------- GCL 2.5.0 CVS (C1) gamma(1.1); (D1) 0.95135076986687 ------------------------------------------------- CLISP 2.29 (C1) gamma(1.1); (D1) .9513507698668733 ------------------------------------------------- CLISP 2.30 (C1) gamma(1.1); WARNING: Floating point operation combines numbers of different precision. See ANSI CL 12.1.4.4 and the CLISP impnotes for details. The result's actual precision is controlled by *FLOATING-POINT-CONTAGION-ANSI*. To shut off this warning, set *WARN-ON-FLOATING-POINT-CONTAGION* to NIL. <snip> (D1) 0.9513507 (C2) :lisp (setq custom::*floating-point-contagion-ansi* t) T (C2) gamma(1.1); WARNING: Floating point operation combines numbers of different precision. See ANSI CL 12.1.4.4 and the CLISP impnotes for details. The result's actual precision is controlled by *FLOATING-POINT-CONTAGION-ANSI*. To shut off this warning, set *WARN-ON-FLOATING-POINT-CONTAGION* to NIL. <snip> (D2) .9513507355077885 ------------------------------------------------------ Notice that all lisps including clisp 2.29 (and 2.28, and 2.27) give exactly the same answer and only clisp 2.30 result differs. Actual computation is performed by gammafloat and gamma-lanczos functions in csimp2.lisp. I'm glad that Raymond pointed out that Maxima redefines float. It solves some mystery to me. Originally I extracted gamma-lanczos into separate file to play with and obtained quite strange results which differ from ones obtained from Maxima. Now I understand why. -- Vadim V. Zhytnikov <vv...@ma...> <vv...@ne...> <vv...@ya...> <vv...@td...> |