Floating point issues (Was Re: Tests fail for Maxima (HEAD) with ECL 8.12.0)
Subject: Floating point issues (Was Re: Tests fail for Maxima (HEAD) with ECL 8.12.0)
From: Raymond Toy
Date: Tue, 07 Apr 2009 14:14:56 -0400
Robert Dodier wrote:
> On Mon, Apr 6, 2009 at 6:23 PM, Raymond Toy <toy.raymond at gmail.com> wrote:
>
>
>> The spec doesn't say how (+ a b) should be computed
>> when a and b are floats. So what?
>>
>
> So, due to this & many other gaps, it's impossible to write a
> portable program. That's a serious deficiency for Maxima.
>
But the same issue would occur if Maxima were written in C, or Fortran,
or Python. I don't think it's unique to Lisp. By this criterion, you
can't write portable C programs either.
We do have the option of implementing everything ourselves. I don't
think we want to do that and but we do want to get the underlying Lisp
to do as much for us as possible.
>
>> (Does any language specify that?)
>>
>
> Java comes to mind.
>
Yes, I guess so. Isn't Java also the language where you write once and
debug everywhere? :-)
I think with the x87 FPU, it's quite difficult to get it to behave as
specified. You either get wrong results or much slower execution for
things that you would have expected to be fast. With SSE2, it's
probably easier to get the desired behavior.
>> It would certainly be nice if this were fixed. I already asked (as you
>> know) about it on the ecl list.
>>
>
> Well, maybe if you point out the relevant fragment of code
> from CMUCL, it could speed the process along.
>
>
Sure. The routine is float-ratio-float in src/code/float.lisp. Looks
self-contained, but I didn't check. The version from clisp or gcl might
be easier to use. I didn't look into either of these. I have no idea
how any of this would fit within ecl.
Ray