(defconstant GOLDEN-RATIO (/ (+ 1.0 (sqrt 5.0)) 2.0)) (defun Fibonacci () "Print a table of representable Fibonacci sequence values. Lisp supports bignums, but we limit the output to values representable in 64-bit integers to make the output comparable to that from other programming languages. With clisp, the last two output columns are limited to 32-bit precision (see Fibonacci4.lsp for a workaround)." (let ((hi 1) (limit (1- (expt 2 63))) (lo 1) (n 1) (ratio)) (format *standard-output* "~2D~A~25D~%" n #\Tab lo) (do nil ((not (< hi limit)) . nil) (setq n (1+ n)) (setq ratio (/ hi lo)) (format *standard-output* "~2D~A~25:D~A~19,15F~A~19,15F~%" n #\Tab hi #\Tab ratio #\Tab (- ratio GOLDEN-RATIO)) (setq hi (+ lo hi)) (setq lo (- hi lo))))) (Fibonacci)