Mercurial > emacs
changeset 108630:ae604e41c198
calc-vec.el (math-vector-avg): Put the vector elements in order
before computing the averages.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Sun, 16 May 2010 23:16:29 -0500 |
parents | 0d592fbcfbe6 |
children | a53949523193 |
files | lisp/ChangeLog lisp/calc/calc-vec.el |
diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun May 16 17:01:22 2010 -0700 +++ b/lisp/ChangeLog Sun May 16 23:16:29 2010 -0500 @@ -1,3 +1,8 @@ +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):
--- a/lisp/calc/calc-vec.el Sun May 16 17:01:22 2010 -0700 +++ b/lisp/calc/calc-vec.el Sun May 16 23:16:29 2010 -0500 @@ -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)