Function: math-floor-fancy

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

Signature

(math-floor-fancy A)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-arith.el.gz
(defun math-floor-fancy (a)
  (cond ((math-provably-integerp a) a)
	((eq (car a) 'hms)
	 (if (or (math-posp a)
		 (and (math-zerop (nth 2 a))
		      (math-zerop (nth 3 a))))
	     (math-trunc a)
	   (math-add (math-trunc a) -1)))
	((eq (car a) 'date) (list 'date (math-floor (nth 1 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))
			 (math-floor (nth 2 a))
			 (if (and (Math-num-integerp (nth 3 a))
				  (memq (nth 1 a) '(0 2)))
			     (math-add (math-floor (nth 3 a)) -1)
			   (math-floor (nth 3 a)))))
	((Math-vectorp a)
         (math-map-vec (lambda (x) (math-floor x math-floor-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 'anglep))))