summaryrefslogtreecommitdiff
path: root/lisp/calc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/calc')
-rw-r--r--lisp/calc/calc-vec.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/calc/calc-vec.el b/lisp/calc/calc-vec.el
index 5f426942e2f..5b807a55491 100644
--- a/lisp/calc/calc-vec.el
+++ b/lisp/calc/calc-vec.el
@@ -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)