[movitz-cvs] CVS update: movitz/losp/muerte/integers.lisp

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Wed Jun 9 20:33:31 UTC 2004


Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory common-lisp.net:/tmp/cvs-serv12302

Modified Files:
	integers.lisp 
Log Message:
Added a horrible isqrt.

Date: Wed Jun  9 13:33:31 2004
Author: ffjeld

Index: movitz/losp/muerte/integers.lisp
diff -u movitz/losp/muerte/integers.lisp:1.29 movitz/losp/muerte/integers.lisp:1.30
--- movitz/losp/muerte/integers.lisp:1.29	Wed Jun  9 13:23:15 2004
+++ movitz/losp/muerte/integers.lisp	Wed Jun  9 13:33:31 2004
@@ -9,7 +9,7 @@
 ;;;; Created at:    Wed Nov  8 18:44:57 2000
 ;;;; Distribution:  See the accompanying file COPYING.
 ;;;;                
-;;;; $Id: integers.lisp,v 1.29 2004/06/09 20:23:15 ffjeld Exp $
+;;;; $Id: integers.lisp,v 1.30 2004/06/09 20:33:31 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -1991,3 +1991,9 @@
 	 (t (values (1- q) (+ r divisor))))))
    (t (n &optional (divisor 1))
       (floor n divisor))))
+
+(defun isqrt (natural)
+  "=> natural-root"
+  (check-type natural (integer 0 *))
+  (do ((i 0 (1+ i)))
+      ((> (* i i) natural) (1- i))))
\ No newline at end of file





More information about the Movitz-cvs mailing list