computing expontential as repeated multiplication for small integer exponent



On 7/29/07, Bill Wood <william.wood3 at comcast.net> wrote:

> Do you have test data that demonstrates the variance in behavior?
> I'll run tests on CMUCL if you like.

Well, here is an example which yields 0.0d0 in Clisp 2.38
and GCL 2.6.7 and a small nonzero number in SBCL 1.0 (all Linux).

(let ((x 1.2345678901234567d0)) (- (expt x 3) (* x x x)))

I don't think there's any need to test it on other Lisps;
that the result differs for at least one of the supported Lisp
implementations is enough.

best
Robert