[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



	(DEFUN FACTORIAL (X)
	       (COND ((ZEROP X) 1)
		     (T (* X (FACTORIAL (1- X))))))

This will behave like the description of the bug report we received from
JM. The bug just stems from the fact that "*" is the fixnum-only 
multiplication operator for Maclisp. It is defined to do whatever the
machine hardware integer multiply does and to not err if overflow occurs.
As a result, you experience wrap-around as your number goes out of bounds.
The solution is to use TIMES, which will be careful about overflow and
help you into the bignum range.

-kmp