Function: math-ceiling
math-ceiling is an autoloaded and byte-compiled function defined in
calc-arith.el.gz.
Signature
(math-ceiling A &optional PREC)
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-arith.el.gz
;;; Coerce A to be an integer (by truncation toward plus infinity). [I N]
(defun math-ceiling (a &optional prec) ; [Public]
(cond (prec
(if (Math-messy-integerp prec)
(setq prec (math-trunc prec)))
(or (integerp prec)
(math-reject-arg prec 'fixnump))
(if (and (<= prec 0)
(math-provably-integerp a))
a
(calcFunc-scf (math-ceiling (let ((calc-prefer-frac t))
(calcFunc-scf a prec)))
(- prec))))
((Math-integerp a) a)
((Math-messy-integerp a) (math-trunc a))
((Math-realp a)
(if (Math-posp a)
(math-add (math-trunc a) 1)
(math-trunc a)))
((math-provably-integerp a) a)
((eq (car a) 'hms)
(if (or (math-negp 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-ceiling (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))
(if (and (Math-num-integerp (nth 2 a))
(memq (nth 1 a) '(0 1)))
(math-add (math-floor (nth 2 a)) 1)
(math-ceiling (nth 2 a)))
(math-ceiling (nth 3 a))))
((Math-vectorp a)
(math-map-vec (lambda (x) (math-ceiling x 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))))