Function: cl-truncate

cl-truncate is an autoloaded and byte-compiled function defined in cl-extra.el.gz.

Signature

(cl-truncate X &optional Y)

Documentation

Return a list of the integer part of X and the fractional part of X.

With two arguments, return truncation and remainder of their quotient.

View in manual

Aliases

truncate* (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-extra.el.gz
;;;###autoload
(defun cl-truncate (x &optional y)
  "Return a list of the integer part of X and the fractional part of X.
With two arguments, return truncation and remainder of their quotient."
  (declare (side-effect-free t))
  (if (eq (>= x 0) (or (null y) (>= y 0)))
      (cl-floor x y) (cl-ceiling x y)))