fix contagion in IOTA when step is a complex integer and start is a float
authorNikodemus Siivola <nikodemus@random-state.net>
Sat, 26 Jan 2013 13:46:01 +0000 (15:46 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Sat, 26 Jan 2013 13:53:10 +0000 (15:53 +0200)
numbers.lisp
tests.lisp

index 9ced84b..beebb58 100644 (file)
@@ -58,9 +58,9 @@ Examples:
 "
   (declare (type (integer 0) n) (number start step))
   (loop repeat n
-     ;; KLUDGE: get numeric contagion right for the first element too
-     for i = (+ start (- step step)) then (+ i step)
-     collect i))
+        ;; KLUDGE: get numeric contagion right for the first element too
+        for i = (+ (- (+ start step) step)) then (+ i step)
+        collect i))
 
 (declaim (inline map-iota))
 (defun map-iota (function n &key (start 0) (step 1))
index 198104c..f203aad 100644 (file)
   t
   t
   t)
+
+(deftest iota.fp-start-and-complex-integer-step
+    (equal '(#C(0.0 0.0) #C(0.0 2.0) #C(0.0 4.0))
+           (iota 3 :start 0.0 :step #C(0 2)))
+  t)