[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] Re: [Maxima] m68k gcl/maxima: Minor Floating point error
Re: [Gcl-devel] Re: [Maxima] m68k gcl/maxima: Minor Floating point errors
19 Sep 2002 13:30:36 -0500
On Thu, 2002-09-19 at 11:09, Richard Fateman wrote:
> I would guess that one is using single precision IEEE
> floats and the other is using double precision. It could
> very well be that your m68k is getting better answers.
It may be the reverse; see below.
> I think the CL standard allows one to implement single-float
> as the same as double-float. A test would be to see for
> what value of n 1.0+2^(-n) = 1.0 e.g.
> for i:1 thru 60 do print ([i,is (1.0d0=1.0d0+2^(-i))]); double
> for i:1 thru 60 do print ([i,is (1.0=1.0+2^(-i))]); single
> for the first one, you should get i=22 for the first true.
> for the second one, i=53 should be the first true.
Ah ha. By that test, single precision float are being implemented as
doubles by all three of GCL, Clisp and CMUCL under Linux.
Camm, what do you get?
> The way I debug lisp functions is first to make sure
> the same answer happens when the code is interpreted rather
> than compiled. (if not, it is a compiler error!)
> Then if they are the same, by using trace. You can
> trace the two different versions and see where they
> give different answers. Rarely I
> insert in the lisp code (break "id") or output statements
> like (format t "~% location xx with values ~s ~s " x y)
> Which all brings to mind the possibility that suggestions
> like this should be in a FAQ ... How do I debug lisp code
> in Maxima.
Yes. Absolutely. CY was going to start a Wiki. What happened to it?
(I'll confess that I've never really used a Wiki, but I believe it is
supposed to be a more flexible implementation of a FAQ.)