summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-ext.el
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2007-08-03 05:21:43 +0000
committerJay Belanger <jay.p.belanger@gmail.com>2007-08-03 05:21:43 +0000
commit6a599ca51fa11aacb38da5bef9c6ffad5cb1ea36 (patch)
tree3711c7e434e058395f1578987005ac50277f96f5 /lisp/calc/calc-ext.el
parent4211679b08d6a9c369cb22f085b9bb61d5d4eeda (diff)
downloademacs-6a599ca51fa11aacb38da5bef9c6ffad5cb1ea36.tar.gz
(math-get-value,math-get-sdev,math-contains-sdev): New functions.
Diffstat (limited to 'lisp/calc/calc-ext.el')
-rw-r--r--lisp/calc/calc-ext.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index b517a54c6f0..5a334778aa5 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -2213,6 +2213,25 @@ calc-kill calc-kill-region calc-yank))))
a
(math-reject-arg a 'constp)))
+;;; Some functions for working with error forms.
+(defun math-get-value (x)
+ "Get the mean value of the error form X.
+If X is not an error form, return X."
+ (if (eq (car-safe x) 'sdev)
+ (nth 1 x)
+ x))
+
+(defun math-get-sdev (x &optional one)
+ "Get the standard deviation of the error form X.
+If X is not an error form, return 1."
+ (if (eq (car-safe x) 'sdev)
+ (nth 2 x)
+ (if one 1 0)))
+
+(defun math-contains-sdev-p (ls)
+ "Non-nil if the list LS contains an error form."
+ (let ((ls (if (eq (car-safe ls) 'vec) (cdr ls) ls)))
+ (memq t (mapcar (lambda (x) (eq (car-safe x) 'sdev)) ls))))
;;; Coerce integer A to be a small integer. [S I]
(defun math-fixnum (a)