Commit 00681a3c authored by Jay Belanger's avatar Jay Belanger
Browse files

calc-vec.el (math-vector-avg): Put the vector elements in order

before computing the averages.
parent 7ca1f3f9
2010-05-17 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calc-vec.el (math-vector-avg): Put the vector elements in
order before computing the averages.
2010-05-16 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calc-vec.el (calc-histogram):
......
......@@ -1178,7 +1178,7 @@
;;; Replace a vector [a b c ...] with a vector of averages
;;; [(a+b)/2 (b+c)/2 ...]
(defun math-vector-avg (vec)
(let ((vp (cdr vec))
(let ((vp (sort (copy-sequence (cdr vec)) 'math-beforep))
(res nil))
(while (and vp (cdr vp))
(setq res (cons (math-div (math-add (car vp) (cadr vp)) 2) res)
......
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