computing expontential as repeated multiplication for small integer exponent



Robert Dodier wrote:
> On 7/30/07, Raymond Toy <raymond.toy at ericsson.com> wrote:
> 
>> But we can't guarantee that FP operations will come out the same
>> unless maxima implements them all.  I don't think we want to do that.
>> The best we can do is assume IEEE arithmetic and assume the 4 basic
>> ops plus sqrt are correct.
> 
> I think we could do better by importing GNU Scientific Library or
> something like that. (Although GSL would require CFFI, which
> GCL doesn't support ... sigh.)

I don't think that solves your issue either.  GSL still involves some 
kind of number reader.  Are we sure the numbers are all read to produce 
exactly the same way?  Perhaps if we're all using exactly the same 
version of gcc (or sufficiently close), but I sometimes use Sun C to 
compile.

And we still have maxima's reader.  I don't recall how it works, but 
eventually it must call the underlying Lisp to make a float.  Are we 
sure that's done exactly the same way?

> 
>> Don't get me wrong.  I understand your desire to have all Lisps
>> produce the same result.  I just don't think making things less
>> accurate is the way to go.  (I have asserted that sbcl has an accurate
>> expt.  I haven't proven it, though.)
> 
> I don't really accept this argument. If different implementation
> disagree, one is more accurate than the others. If we always
> had to preserve the most accurate one, we could never force
> them to agree. But that's really beside the point, which is that

I don't think forcing them to agree is the point.  We just need to 
understand why they're different and that they're not so different as to 
be erroneous.  This is tedious and error-prone.

> EXPT is not really very important.

Uh, ok.

Ray