Function: math-div-symb-fancy

math-div-symb-fancy is an autoloaded and byte-compiled function defined in calc-arith.el.gz.

Signature

(math-div-symb-fancy A B)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-arith.el.gz
(defun math-div-symb-fancy (a b)
  (or (and (math-known-matrixp b)
           (math-mul a (math-pow b -1)))
      (and math-simplify-only
	   (not (equal a math-simplify-only))
	   (list '/ a b))
      (and (Math-equal-int b 1) a)
      (and (Math-equal-int b -1) (math-neg a))
      (and (Math-vectorp a) (math-known-scalarp b)
	   (math-map-vec-2 'math-div a b))
      (and (eq (car-safe b) '^)
	   (or (Math-looks-negp (nth 2 b)) (Math-equal-int a 1))
	   (math-mul a (math-normalize
			(list '^ (nth 1 b) (math-neg (nth 2 b))))))
      (and (eq (car-safe a) 'neg)
	   (math-neg (math-div (nth 1 a) b)))
      (and (eq (car-safe b) 'neg)
	   (math-neg (math-div a (nth 1 b))))
      (and (eq (car-safe a) '/)
	   (math-div (nth 1 a) (math-mul (nth 2 a) b)))
      (and (eq (car-safe b) '/)
	   (or (math-known-scalarp (nth 1 b) t)
	       (math-known-scalarp (nth 2 b) t))
	   (math-div (math-mul a (nth 2 b)) (nth 1 b)))
      (and (eq (car-safe b) 'frac)
	   (math-mul (math-make-frac (nth 2 b) (nth 1 b)) a))
      (and (eq (car-safe a) '+)
	   (or (Math-numberp (nth 1 a))
	       (Math-numberp (nth 2 a)))
	   (Math-numberp b)
	   (math-add (math-div (nth 1 a) b)
		     (math-div (nth 2 a) b)))
      (and (eq (car-safe a) '-)
	   (or (Math-numberp (nth 1 a))
	       (Math-numberp (nth 2 a)))
	   (Math-numberp b)
	   (math-sub (math-div (nth 1 a) b)
		     (math-div (nth 2 a) b)))
      (and (or (eq (car-safe a) '-)
	       (math-looks-negp a))
	   (math-looks-negp b)
	   (math-div (math-neg a) (math-neg b)))
      (and (eq (car-safe b) '-)
	   (math-looks-negp a)
	   (math-div (math-neg a) (math-neg b)))
      (and (eq (car-safe a) 'calcFunc-idn)
	   (= (length a) 2)
	   (or (and (eq (car-safe b) 'calcFunc-idn)
		    (= (length b) 2)
		    (list 'calcFunc-idn (math-div (nth 1 a) (nth 1 b))))
	       (and (math-known-scalarp b)
		    (list 'calcFunc-idn (math-div (nth 1 a) b)))
	       (and (math-known-matrixp b)
		    (math-div (nth 1 a) b))))
      (and (eq (car-safe b) 'calcFunc-idn)
	   (= (length b) 2)
	   (or (and (math-known-scalarp a)
		    (list 'calcFunc-idn (math-div a (nth 1 b))))
	       (and (math-known-matrixp a)
		    (math-div a (nth 1 b)))))
      (and math-simplifying
           (let ((math-div-trig nil)
                 (math-div-non-trig nil))
             (math-div-isolate-trig b)
             (if math-div-trig
                 (if math-div-non-trig
                     (math-div (math-mul a math-div-trig) math-div-non-trig)
                   (math-mul a math-div-trig))
               nil)))
      (if (and calc-matrix-mode
	       (or (math-known-matrixp a) (math-known-matrixp b)))
	  (math-combine-prod a b nil t nil)
	(if (eq (car-safe a) '*)
	    (if (eq (car-safe b) '*)
		(let ((c (math-combine-prod (nth 1 a) (nth 1 b) nil t t)))
		  (and c
		       (math-div (math-mul c (nth 2 a)) (nth 2 b))))
	      (let ((c (math-combine-prod (nth 1 a) b nil t t)))
		(and c
		     (math-mul c (nth 2 a)))))
	  (if (eq (car-safe b) '*)
	      (let ((c (math-combine-prod a (nth 1 b) nil t t)))
		(and c
		     (math-div c (nth 2 b))))
	    (math-combine-prod a b nil t nil))))
      (and (math-infinitep a)
	   (if (math-infinitep b)
	       '(var nan var-nan)
	     (if (or (equal a '(var nan var-nan))
		     (equal a '(var uinf var-uinf)))
		 a
	       (if (equal a '(var inf var-inf))
		   (if (or (math-posp b)
			   (and (eq (car-safe b) 'intv)
				(math-zerop (nth 2 b))))
		       (if (and (eq (car-safe b) 'intv)
				(not (math-intv-constp b t)))
			   '(intv 3 0 (var inf var-inf))
			 a)
		     (if (or (math-negp b)
			     (and (eq (car-safe b) 'intv)
			      (math-zerop (nth 3 b))))
			 (if (and (eq (car-safe b) 'intv)
				  (not (math-intv-constp b t)))
			     '(intv 3 (neg (var inf var-inf)) 0)
			   (math-neg a))
		       (if (and (eq (car-safe b) 'intv)
				(math-negp (nth 2 b)) (math-posp (nth 3 b)))
			   '(intv 3 (neg (var inf var-inf))
				  (var inf var-inf)))))))))
      (and (math-infinitep b)
	   (if (equal b '(var nan var-nan))
	       b
	     (let ((calc-infinite-mode 1))
	       (math-mul-zero b a))))
      (list '/ a b)))