The patch below is self-explanatory. Unfortunately, several Common Lisps out there allow the use of illegal and underspecified LOOP statements --- but beware that such statements are not Common Lisp and their outcome is undefined (in particular, ECL signals an error).
diff --git a/src/math.lisp b/src/math.lisp
index 9d428c7..955d6f7 100644
@@ -8,6 +8,20 @@ denominator."
(type integer a b))
(assert (and (>= a 0)
(>= b 0)))
Thanks for the patch. For future patches, please actually remove the incorrect code, rather than just providing an alternative and commenting out the offending form. A pull request would be even better.
@eadmund, does @juanjosegarciaripoll's translation of LOOP into DO look correct to you?
After looking at this more closely, this patch cannot be correct. Q is not defined in the new loop.
Hopefully this time github will not screw my text. The patch here
corrects the problems of my original patch (one typo and the lack of a binding for Q). I tested it with SBCL so that the new function reproduces the undefined behavior of the original one.
Fixed in commit fc2ac2e. Thanks for the fix.