Function: math-trunc-fancy
math-trunc-fancy is an autoloaded and byte-compiled function defined
in calc-arith.el.gz.
Signature
(math-trunc-fancy A)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-arith.el.gz
(defun math-trunc-fancy (a)
(cond ((eq (car a) 'frac) (math-quotient (nth 1 a) (nth 2 a)))
((eq (car a) 'cplx) (math-trunc (nth 1 a)))
((eq (car a) 'polar) (math-trunc (math-complex a)))
((eq (car a) 'hms) (list 'hms (nth 1 a) 0 0))
((eq (car a) 'date) (list 'date (math-trunc (nth 1 a))))
((eq (car a) 'mod)
(if (math-messy-integerp (nth 2 a))
(math-trunc (math-make-mod (nth 1 a) (math-trunc (nth 2 a))))
(math-make-mod (math-trunc (nth 1 a)) (nth 2 a))))
((eq (car a) 'intv)
(math-make-intv (+ (if (and (equal (nth 2 a) '(neg (var inf var-inf)))
(memq (nth 1 a) '(0 1)))
0 2)
(if (and (equal (nth 3 a) '(var inf var-inf))
(memq (nth 1 a) '(0 2)))
0 1))
(if (and (Math-negp (nth 2 a))
(Math-num-integerp (nth 2 a))
(memq (nth 1 a) '(0 1)))
(math-add (math-trunc (nth 2 a)) 1)
(math-trunc (nth 2 a)))
(if (and (Math-posp (nth 3 a))
(Math-num-integerp (nth 3 a))
(memq (nth 1 a) '(0 2)))
(math-add (math-trunc (nth 3 a)) -1)
(math-trunc (nth 3 a)))))
((math-provably-integerp a) a)
((Math-vectorp a)
(math-map-vec (lambda (x) (math-trunc x math-trunc-prec)) a))
((math-infinitep a)
(if (or (math-posp a) (math-negp a))
a
'(var nan var-nan)))
((math-to-integer a))
(t (math-reject-arg a 'numberp))))