]> git.eshelyaron.com Git - emacs.git/commitdiff
(calcFunc-apart): Improve test for rational functions.
authorJay Belanger <jay.p.belanger@gmail.com>
Sat, 24 Jan 2009 02:27:04 +0000 (02:27 +0000)
committerJay Belanger <jay.p.belanger@gmail.com>
Sat, 24 Jan 2009 02:27:04 +0000 (02:27 +0000)
lisp/ChangeLog
lisp/calc/calc-poly.el

index 01e8e2dfdf267886f8363cbb09aae12130242029..5550a2ceb83ac067418cda26e4e85e546ad80d47 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-24  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-poly.el (calcFunc-apart): Improve test for
+       rational functions.
+
 2009-01-23  Chong Yidong  <cyd@stupidchicken.com>
 
        * mail/rmailsum.el (rmail-summary-by-labels): Correctly handle
index 7385e42c85138bf59ca0251a0c4a655c422de0e5..2246df94414cb63b0aba2f5ce5a014927328d3df 100644 (file)
        ((eq (car expr) '-)
         (math-sub (calcFunc-apart (nth 1 expr) var)
                   (calcFunc-apart (nth 2 expr) var)))
-       ((not (math-ratpoly-p expr var))
-        (math-reject-arg expr "Expected a rational function"))
+        ((and var (not (math-ratpoly-p expr var)))
+         (math-reject-arg expr "Expected a rational function"))
        (t
-        (let* ((calc-prefer-frac t)
-               (rat (math-to-ratpoly expr))
-               (num (car rat))
-               (den (cdr rat))
-               (qr (math-poly-div num den))
-               (q (car qr))
-               (r (cdr qr)))
-          (or var
-              (setq var (math-polynomial-base den)))
-          (math-add q (or (and var
-                               (math-expr-contains den var)
-                               (math-partial-fractions r den var))
-                          (math-div r den)))))))
+         (let* ((calc-prefer-frac t)
+                (rat (math-to-ratpoly expr))
+                (num (car rat))
+                (den (cdr rat)))
+           (or var
+               (setq var (math-polynomial-base den)))
+           (if (not (math-ratpoly-p expr var))
+               (math-reject-arg expr "Expected a rational function")
+             (let* ((qr (math-poly-div num den))
+                    (q (car qr))
+                    (r (cdr qr)))
+               (math-add q (or (and var
+                                    (math-expr-contains den var)
+                                    (math-partial-fractions r den var))
+                               (math-div r den)))))))))
 
 
 (defun math-padded-polynomial (expr var deg)