[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] Re: [ 101603 ] numerical quirks

From: Peter Wood
Subject: Re: [Gcl-devel] Re: [ 101603 ] numerical quirks
Date: Tue, 10 Dec 2002 17:46:32 +0100
User-agent: Mutt/1.4i


On Sun, Dec 08, 2002 at 05:52:10PM -0500, Camm Maguire wrote:
> Greetings!  I'm forwarding your note to the address@hidden list to
> solicit comments on what a compliant lisp system should do in the
> instances you note.  They all fall under the general rubric of fixed
> precision floating point arithmetic.  Is lisp supposed to be able to
> handle arbitrary precision floating point?  Does any implementation do
> this?  I heard rumors once that clisp used gmp for floats too.  From
> my understanding of earlier threads, a lisp implementation is not
> supposed to be able to recognize and return exact answers to special
> floating point problems, e.g. cos(pi/2), sqrt(-1), etc.


> > This is actually a bug report, but your project seems
> > to have the bug tracking tool turned off, so I'll write
> > it here. Lisp is good at handling numbers. Accordingly,
> > gcl can handle arbitrarily large integers. Thus, (expt
> > 2 (expt 2 (expt 2 (expt 2 2)))) works. However, if you
> > try subtracting 0.5 from it, gcl declares that the
> > result is a non-number. I can understand limited
> > floating-point precision, but its range should be
> > unbounded, especially when integers are handled so
> > well. Specifically, the internal variable in floats
> > indicating order of magnitude should use just these
> > unbounded integers.
> > Second of all, why is (sqrt -1)
> > #C(6.1230317691118863E-17 1.0)? I'm using gcl from
> > Debian sid, version 2.5.0.cvs20020625-70.

(expt 2 (expt 2 (expt 2 (expt 2 2)))) causes SBCL and CMUCL to barf.
Clisp does it fine, but signals floating point overflow when
subtracting 0.5 from the result.  Lispworks handles it fine, but
produces something strange when subtracting 0.5 from it.

Here are the results for (sqrt -1) for these systems.

* (sqrt -1)

#C(0.0 1.0)

* (sqrt -1)

#C(0.0 1.0)

[1]> (sqrt -1)
#C(0 1)

CL-USER 1 >  (sqrt -1)
#C(0.0 1.0)

Are they special casing it?  If we don't have to handle this stuff,
I don't think we should bother?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]