aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2007-08-03 05:21:43 +0000
committerJay Belanger2007-08-03 05:21:43 +0000
commit6a599ca51fa11aacb38da5bef9c6ffad5cb1ea36 (patch)
tree3711c7e434e058395f1578987005ac50277f96f5
parent4211679b08d6a9c369cb22f085b9bb61d5d4eeda (diff)
downloademacs-6a599ca51fa11aacb38da5bef9c6ffad5cb1ea36.tar.gz
emacs-6a599ca51fa11aacb38da5bef9c6ffad5cb1ea36.zip
(math-get-value,math-get-sdev,math-contains-sdev): New functions.
-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))))
2213 a 2213 a
2214 (math-reject-arg a 'constp))) 2214 (math-reject-arg a 'constp)))
2215 2215
2216;;; Some functions for working with error forms.
2217(defun math-get-value (x)
2218 "Get the mean value of the error form X.
2219If X is not an error form, return X."
2220 (if (eq (car-safe x) 'sdev)
2221 (nth 1 x)
2222 x))
2223
2224(defun math-get-sdev (x &optional one)
2225 "Get the standard deviation of the error form X.
2226If X is not an error form, return 1."
2227 (if (eq (car-safe x) 'sdev)
2228 (nth 2 x)
2229 (if one 1 0)))
2230
2231(defun math-contains-sdev-p (ls)
2232 "Non-nil if the list LS contains an error form."
2233 (let ((ls (if (eq (car-safe ls) 'vec) (cdr ls) ls)))
2234 (memq t (mapcar (lambda (x) (eq (car-safe x) 'sdev)) ls))))
2216 2235
2217;;; Coerce integer A to be a small integer. [S I] 2236;;; Coerce integer A to be a small integer. [S I]
2218(defun math-fixnum (a) 2237(defun math-fixnum (a)