Subject: Re: Round to the nearest whole number?
From: Erik Naggum <erik@naggum.net>
Date: 29 Nov 2000 01:34:28 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3184450468066295@naggum.net>

* Andy Haywood <andyhaywood@cwcom.net>
| I would want it to return 3.

  If you want that, you don't want rounding, but some sort of fraudulent
  scheme perpetrated by merchants and banks and other money institutions
  who want to keep your round-off change.  Less rebelliously, the sum of
  _rounded_ values should equal the rounded sum of the unrounded values,
  and if this does not hold, you have an _unmathematical_ operation.

  However, you may well define your "rounding" function thus:

(defun penny-theft (number)
  (multiple-value-bind (rounded rest)
      (truncate (+ number .5))
    (values rounded (- rest .5))))

#:Erik
-- 
  Solution to U.S. Presidential Election Crisis 2000:
    Let Texas secede from the Union and elect George W. Bush their
    very first President.  All parties, states would rejoice.