help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: bigger integers


From: Kevin Rodgers
Subject: Re: bigger integers
Date: Tue, 07 Sep 2004 11:46:46 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Joe Corneli wrote:
>    After all, emacs lisp is designed to count characters in a file,
>    not to compute factorials.
>
>  "Emacs is the extensible, customizable, self-documenting real-time
>  display editor."
>
> If I can't extend or customize it to compute 12! then there seems to
> be something missing.  Kevin's factorial works though so I guess
> that's good enough for me... oh wait a second now it stopped working.
>
>   Debugger entered--Lisp error: (error "Lisp nesting exceeds 
max-lisp-eval-depth")

The obvious pseudo-fix is something like:

(setq max-lisp-eval-depth (* 42 max-lisp-eval-depth))

>   (factorial (1- num))
>   (* num (factorial (1- num)))
>   (if (<= num 0) 1.0 (* num (factorial ...)))
>   factorial(7)
>   (* num (factorial (1- num)))
>   (if (<= num 0) 1.0 (* num (factorial ...)))
>   factorial(8)
>   (* num (factorial (1- num)))
>   (if (<= num 0) 1.0 (* num (factorial ...)))
>   factorial(9)
>   (* num (factorial (1- num)))
>   (if (<= num 0) 1.0 (* num (factorial ...)))
>   factorial(10)
>   (* num (factorial (1- num)))
>   (if (<= num 0) 1.0 (* num (factorial ...)))
>   factorial(11)
>   (* num (factorial (1- num)))
>   (if (<= num 0) 1.0 (* num (factorial ...)))
>   factorial(12)
>   eval((factorial 12))
>
> (This same computation was fine just a minute ago, then I tried to
> compute 100! and now it doesn't want to do 12! any more.)

That's weird, it sounds like the stack has been corrupted.

--
Kevin Rodgers


reply via email to

[Prev in Thread] Current Thread [Next in Thread]