computing expontential as repeated multiplication for small integer exponent
Subject: computing expontential as repeated multiplication for small integer exponent
From: Barton Willis
Date: Mon, 30 Jul 2007 11:32:19 -0500
Using 5.12 and GLC, the test suite is OK with
(defun exptb (x n)
(if (integerp x) (cl-rat-to-maxima (expt x n)) (expt x n)))
(1) The test suite uses a fuzz factor of 8 * machine epsilon to test
for equality of floats. I choose the factor 8 simply because it allowed
the test suite to pass using GCL. Other than that, there is no logic behind
my choice. Before we change exptb, let's consider changing the equality
test
for floats.
(2) We've been shifting numerical work to CL for sometime (trig and
log-like functions).
This is one reason for the fuzz factor in the test suite. I think this
shift has been
mostly good thing (not 100% good). It seems consistent to move
exponentiation to CL as well.
Already different Lisp versions give different float results.
Barton