Function: calcFunc-re
calcFunc-re is an autoloaded and byte-compiled function defined in
calc-cplx.el.gz.
Signature
(calcFunc-re A)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-cplx.el.gz
;;; Extract the real or complex part of a complex number. [R N] [Public]
;;; Also extracts the real part of a modulo form.
(defun calcFunc-re (a)
(let (aa bb)
(cond ((Math-realp a) a)
((memq (car a) '(mod cplx))
(nth 1 a))
((eq (car a) 'polar)
(math-mul (nth 1 a) (calcFunc-cos (nth 2 a))))
((eq (car a) 'vec)
(math-map-vec 'calcFunc-re a))
((math-known-realp a) a)
((eq (car a) 'calcFunc-conj)
(calcFunc-re (nth 1 a)))
((and (equal a '(var i var-i))
(math-imaginary-i))
0)
((and (memq (car a) '(+ - *))
(progn
(setq aa (calcFunc-re (nth 1 a))
bb (calcFunc-re (nth 2 a)))
(or (not (eq (car-safe aa) 'calcFunc-re))
(not (eq (car-safe bb) 'calcFunc-re)))))
(if (eq (car a) '+)
(math-add aa bb)
(if (eq (car a) '-)
(math-sub aa bb)
(math-sub (math-mul aa bb)
(math-mul (calcFunc-im (nth 1 a))
(calcFunc-im (nth 2 a)))))))
((and (eq (car a) '/)
(math-known-realp (nth 2 a)))
(math-div (calcFunc-re (nth 1 a)) (nth 2 a)))
((eq (car a) 'neg)
(math-neg (calcFunc-re (nth 1 a))))
(t (calc-record-why 'numberp a)
(list 'calcFunc-re a)))))