[cmucl-help] 0 to a power

Raymond Toy toy.raymond at gmail.com
Fri Jan 1 16:04:38 UTC 2016


On Fri, Jan 1, 2016 at 7:51 AM, Matt Kaufmann <kaufmann at cs.utexas.edu>
wrote:

> Hi --
>
> I'm seeing that evaluation of (expt 0 10001) results in an error, as
> does (expt 0 k) for any k above 10000 as far as I can tell.  Details
> are in the log below.  Interestingly, a base of 1 doesn't cause this
> problem; e.g., (expt 1 10000000000000000000000) evaluates to 1; so I
> wonder if the error with 0 could be avoided.
>

​Yeah we should probably shortcut to return 0 or signal divide-by-zero (or
something) for negative exponents.  At least for integer exponents and an
exact 0.

The case for (expt 1 n) was added sometime ago because maxima used to do
that quite often and that was too annoying to me.​


-- 
Ray


More information about the cmucl-help mailing list