diff lisp/calc/calc-ext.el @ 91000:cd5e99697764

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 843-844) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 84-87) - Update from CVS - Change capitalization of VC backend names for new backends Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-241
author Miles Bader <miles@gnu.org>
date Fri, 03 Aug 2007 05:57:16 +0000
parents f55f9811f5d7 5dbe5cf5ad96
children aaccdab0ee26
line wrap: on
line diff
--- a/lisp/calc/calc-ext.el	Fri Aug 03 05:27:05 2007 +0000
+++ b/lisp/calc/calc-ext.el	Fri Aug 03 05:57:16 2007 +0000
@@ -2213,6 +2213,25 @@
       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)