emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/calc/calc-arith.el


From: Jay Belanger
Subject: [Emacs-diffs] Changes to emacs/lisp/calc/calc-arith.el
Date: Mon, 29 Nov 2004 17:47:30 -0500

Index: emacs/lisp/calc/calc-arith.el
diff -c emacs/lisp/calc/calc-arith.el:1.8 emacs/lisp/calc/calc-arith.el:1.9
*** emacs/lisp/calc/calc-arith.el:1.8   Thu Nov 25 06:28:25 2004
--- emacs/lisp/calc/calc-arith.el       Mon Nov 29 22:41:10 2004
***************
*** 1740,1762 ****
    (math-normalize (list '^ a b)))
  
  (defun math-pow-of-zero (a b)
!   (if (Math-zerop b)
!       (if calc-infinite-mode
!         '(var nan var-nan)
!       (math-reject-arg (list '^ a b) "*Indeterminate form"))
!     (if (math-floatp b) (setq a (math-float a)))
!     (if (math-posp b)
!       a
!       (if (math-negp b)
!         (math-div 1 a)
!       (if (math-infinitep b)
!           '(var nan var-nan)
!         (if (and (eq (car b) 'intv) (math-intv-constp b)
!                  calc-infinite-mode)
!             '(intv 3 (neg (var inf var-inf)) (var inf var-inf))
!           (if (math-objectp b)
!               (list '^ a b)
!             a)))))))
  
  (defun math-pow-zero (a b)
    (if (eq (car-safe a) 'mod)
--- 1740,1774 ----
    (math-normalize (list '^ a b)))
  
  (defun math-pow-of-zero (a b)
!   "Raise A to the power of B, where A is a form of zero."
!   (if (math-floatp b) (setq a (math-float a)))
!   (cond
!    ;; 0^0 = 1
!    ((eq b 0)
!     1)
!    ;; 0^0.0, etc., are undetermined
!    ((Math-zerop b)
!     (if calc-infinite-mode
!         '(var nan var-nan)
!       (math-reject-arg (list '^ a b) "*Indeterminate form")))
!    ;; 0^positive = 0
!    ((math-posp b)
!     a)
!    ;; 0^negative is undefined (let math-div handle it)
!    ((math-negp b)
!     (math-div 1 a))
!    ;; 0^infinity is undefined
!    ((math-infinitep b)
!     '(var nan var-nan))
!    ;; Some intervals
!    ((and (eq (car b) 'intv)
!          calc-infinite-mode
!          (math-negp (nth 2 b))
!          (math-posp (nth 3 b)))
!     '(intv 3 (neg (var inf var-inf)) (var inf var-inf)))
!    ;; If none of the above, leave it alone.
!    (t
!     (list '^ a b))))
  
  (defun math-pow-zero (a b)
    (if (eq (car-safe a) 'mod)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]