diff options
author | Daniel Santos <dacs.git@brilhante.top> | 2023-02-25 16:16:23 +0000 |
---|---|---|
committer | Daniel Santos <dacs.git@brilhante.top> | 2023-02-25 16:16:23 +0000 |
commit | f3909a9b8ed8bb940ee126b9dfbe131a666b7478 (patch) | |
tree | 403614d13100cd4222600ee3d8d1f68183ba003e /plus-inc.lisp | |
parent | 737859a9a6ef329b64468800f3513de72b749018 (diff) | |
download | cl-math-f3909a9b8ed8bb940ee126b9dfbe131a666b7478.tar.gz |
Diffstat (limited to 'plus-inc.lisp')
-rw-r--r-- | plus-inc.lisp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plus-inc.lisp b/plus-inc.lisp index 1d37417..ddfb835 100644 --- a/plus-inc.lisp +++ b/plus-inc.lisp @@ -104,3 +104,9 @@ (defun tab (fn a) (dotimes (b 5) (format t "~d . ~d = ~d~%" (1+ b) a (funcall fn (1+ b) a)))) + +(defun div (a b &optional (cycle 1)) + "Division between a and b from any numerical system." + (cond + ((< (- a (1- b)) cycle) (values (1- cycle) (- a (1- cycle)))) + (t (div (- a (1- b)) b (1+ cycle))))) |