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

 
 

bug #13068: strange behaviour with big numbers

Submitted by:  None
Submitted on:  Thu 12 May 2005 08:21:30 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 21 Nov 2013 10:26:48 PM UTCcammStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup