comparison lisp/=cl.el @ 3346:0047b8501fce

(mod): Use cl-floor. (rem): Use cl-truncate.
author Richard M. Stallman <rms@gnu.org>
date Mon, 31 May 1993 07:19:04 +0000
parents 762660cd6d9d
children a8401c78dadc
comparison
equal deleted inserted replaced
3345:38168270a9ca 3346:0047b8501fce
1804 ;;; These two functions access the implementation-dependent representation of 1804 ;;; These two functions access the implementation-dependent representation of
1805 ;;; the multiple value returns. 1805 ;;; the multiple value returns.
1806 1806
1807 (defun mod (number divisor) 1807 (defun mod (number divisor)
1808 "Return remainder of X by Y (rounding quotient toward minus infinity). 1808 "Return remainder of X by Y (rounding quotient toward minus infinity).
1809 That is, the remainder goes with the quotient produced by `floor'. 1809 That is, the remainder goes with the quotient produced by `cl-floor'.
1810 Emacs Lisp hint: 1810 Emacs Lisp hint:
1811 If you know that both arguments are positive, use `%' instead for speed." 1811 If you know that both arguments are positive, use `%' instead for speed."
1812 (floor number divisor) 1812 (cl-floor number divisor)
1813 (cadr *mvalues-values*)) 1813 (cadr *mvalues-values*))
1814 1814
1815 (defun rem (number divisor) 1815 (defun rem (number divisor)
1816 "Return remainder of X by Y (rounding quotient toward zero). 1816 "Return remainder of X by Y (rounding quotient toward zero).
1817 That is, the remainder goes with the quotient produced by `truncate'. 1817 That is, the remainder goes with the quotient produced by `cl-truncate'.
1818 Emacs Lisp hint: 1818 Emacs Lisp hint:
1819 If you know that both arguments are positive, use `%' instead for speed." 1819 If you know that both arguments are positive, use `%' instead for speed."
1820 (truncate number divisor) 1820 (cl-truncate number divisor)
1821 (cadr *mvalues-values*)) 1821 (cadr *mvalues-values*))
1822 1822
1823 ;;; internal utilities 1823 ;;; internal utilities
1824 ;;; 1824 ;;;
1825 ;;; safe-idiv performs an integer division with positive numbers only. 1825 ;;; safe-idiv performs an integer division with positive numbers only.