bugGNU Common Lisp - Bugs: bug #13068, strange behaviour with big numbers

 
 

bug #13068: strange behaviour with big numbers

Submitter:  None
Submitted:  Thu 12 May 2005 08:21:30 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 21 Nov 2013 10:26:48 PM UTC, comment #1: 

Thanks for your report!  Fixed in the latest release, 2.6.10.

Camm Maguire <camm>
Group administrator
Thu 12 May 2005 08:21:30 PM UTC, original submission:  

Hello,


I played around a little bit with fibonacci numbers. But when they get too large, the output gets strage (just special characters) and my terminal crashes.

I entered the following lines at toplevel:



(defun exponent-loop-matrix (x e n)
  (if (eq e 0) n
    (exponent-loop-matrix
     (matrix-mult x x)
     (ash e -1)
     (if (eq 1 (logand e 1)) (matrix-mult n x) n))))

(defun matrix-mult (m n)
  (let ((a (aref m 0)) (b (aref m 1)) (c (aref m 2))
(d (aref n 0)) (e (aref n 1)) (f (aref n 2)))
    (vector (+ ( a d) ( b e)) (+ ( b d) ( c e)) (+ ( b e) ( c f)))))

(defun exponent-matrix (x e) (exponent-loop-matrix x e (vector 1 0 1)))

(defun fibonacci (n)
  (aref (exponent-matrix (vector 1 1 0) (- n 1)) 0))

(compile 'fibonacci)
(compile 'exponent-matrix)
(compile 'exponent-loop-matrix)
(compile 'matrix-mult)

(fibonacci 3500000)



I am using GCL 2.6.6 (latest Debian package) on an i686 Debian GNU/Linux installation. Numbers below (fibonacci 3123698) work as exspected. (The bound is sometimes a little bit higher).


I hope this helps.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by camm (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-11-21 camm StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code