[Maxima] computing expontential as repeated multiplication for small integer exponent
raymond.toy at ericsson.com
Mon Jul 30 09:49:56 CDT 2007
Robert Dodier wrote:
> At present there is test suite case which fails (#69 in rtest8)
> for some Lisp implementations, apparently due to different
> results returned by the Lisp built-in function EXPT.
> I find that the attached patch for Maxima's EXPTB makes the
> result of rtest8 #69 come out the same for the Lisp
> implementations I have tested (SBCL, GCL, Clisp).
> Before, GCL and Clisp agreed and SBCL was different.
> This is somewhat cheesy so I thought I would gather 2nd
> opinions before committing. Comments? Maybe there is
> a better way to go about resolving this problem?
I don't think we should do this. I don't know what gcl and clisp are
doing, but I think cmucl and sbcl have quite accurate implementations of
Your example of 1.2345678901234567d0^3 just illustrates that expt and
multiplication are different. As best as I can tell, (expt x 3) from
cmucl (and sbcl?) is more accurate than repeated multiplication.
I think rtest8 #69 shouldn't expect exactly the same result. We should
add a fuzz factor, like in some of the other tests for approximately equal.
More information about the Maxima