[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
trunc
- To: Common-Lisp at SU-AI
- Subject: trunc
- From: Earl A. Killian <Killian at MIT-MULTICS>
- Date: Wed, 07 Jul 1982 18:20:00 -0000
Warning: the definition of trunc in Common Lisp is not the same as an
integer divide instruction on most machines (except the S-1). The
difference occurs when the divisor is negative. For example, (trunc 5
-2) is defined to be the same as (trunc (/ 5 -2)) = (trunc -2.5) = -2,
whereas most machines divide such that the sign of the remainder is the
same as the sign of the dividend (aka numerator), which gives -3 for
5/-2.
Implementors should make sure that they do the appropriate testing
(ugh), unless someone wants to propose kludging the definition.