Commit 979f7916 authored by Johan Ur Riise's avatar Johan Ur Riise
Browse files

fix median

parent 700ed97b
......@@ -97,7 +97,7 @@ interpolation coefficient V."
(middle (truncate length 2)))
(if (oddp length)
(aref vector middle)
(/ (+ (aref vector middle) (aref vector (1+ middle))) 2))))
(/ (+ (aref vector middle) (aref vector (1- middle))) 2))))
(declaim (inline variance))
(defun variance (sample &key (biased t))
......
......@@ -855,7 +855,7 @@
(deftest median.2
(median '(100 0 99 1 98 2 97 96))
195/2)
193/2)
(deftest variance.1
(variance (list 1 2 3))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment