Commit 6adaed78 authored by Jay Belanger's avatar Jay Belanger
Browse files

(math-pow-of-zero): Take into account different cases.

parent 5f9e0ca5
...@@ -1740,23 +1740,35 @@ ...@@ -1740,23 +1740,35 @@
(math-normalize (list '^ a b))) (math-normalize (list '^ a b)))
(defun math-pow-of-zero (a b) (defun math-pow-of-zero (a b)
(if (Math-zerop b) "Raise A to the power of B, where A is a form of zero."
(if calc-infinite-mode (if (math-floatp b) (setq a (math-float a)))
'(var nan var-nan) (cond
(math-reject-arg (list '^ a b) "*Indeterminate form")) ;; 0^0 = 1
(if (math-floatp b) (setq a (math-float a))) ((eq b 0)
(if (math-posp b) 1)
a ;; 0^0.0, etc., are undetermined
(if (math-negp b) ((Math-zerop b)
(math-div 1 a) (if calc-infinite-mode
(if (math-infinitep b) '(var nan var-nan)
'(var nan var-nan) (math-reject-arg (list '^ a b) "*Indeterminate form")))
(if (and (eq (car b) 'intv) (math-intv-constp b) ;; 0^positive = 0
calc-infinite-mode) ((math-posp b)
'(intv 3 (neg (var inf var-inf)) (var inf var-inf)) a)
(if (math-objectp b) ;; 0^negative is undefined (let math-div handle it)
(list '^ a b) ((math-negp b)
a))))))) (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) (defun math-pow-zero (a b)
(if (eq (car-safe a) 'mod) (if (eq (car-safe a) 'mod)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment