ch2_3_rounding
Rounding functions
ROUND
, FLOOR
, CEILING
, TRUNCATE
LabLISP rounding functions emulate CommonLISP. Each needs one numerical argument. Can have optional second argument (divisor), which has to be non-zero. If no optional divisor is given, integer 1 is assumed.
Each of these functions returns two values: integer quotient and remainder.
quotient * divisor + remainder = number
ROUND
rounds number divided by divisor to nearest integer.
>(round 2.4) 2 0.4 >(round 7.7 2) 4 -0.3
FLOOR
rounds towards nearest lower or equal integer.
CEILING
rounds towards nearest higher or equal integer.
TRUNCATE
rounds towards zero.
ch2_3_rounding.txt · Last modified: 2025/01/20 09:26 by admin