fork download
  1. (defparameter *memo* (make-hash-table))
  2.  
  3. (defun f (n)
  4. (let ((m (gethash n *memo*)))
  5. (if m
  6. m
  7. (setf (gethash n *memo*)
  8. (cond ((= n 0) 4)
  9. ((= n 1) 17/4)
  10. (t (+ (- 108 (/ 815 (f (- n 1))))
  11. (/ 1500 (* (f (- n 1)) (f (- n 2)))))))))))
  12.  
  13. (let ((a (f 15)))
  14. (format t "~A~%" a)
  15. (format t "~,10F~%" a)
  16. ;; stackoverflow.com/a/3321167
  17. (multiple-value-bind (q r) (truncate a)
  18. (format t "~D.~10,'0,D~%" q (truncate (* (abs r) (expt 10 10))))))
  19.  
Success #stdin #stdout 0.01s 29524KB
stdin
Standard input is empty
stdout
76315468673/15265963516
4.9990600000
4.9990600719