From ... Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeeds.belnet.be!news.belnet.be!news.tele.dk!129.240.148.23!uio.no!Norway.EU.net!127.0.0.1!nobody From: Erik Naggum Newsgroups: comp.lang.lisp Subject: Re: Round to the nearest whole number? Date: 29 Nov 2000 01:34:28 +0000 Organization: Naggum Software; vox: +47 800 35477; gsm: +47 93 256 360; fax: +47 93 270 868; http://naggum.no; http://naggum.net Lines: 21 Message-ID: <3184450468066295@naggum.net> References: <271120001453264352%sungwoo@cad.strath.ac.uk> <271120001510300782%sungwoo@cad.strath.ac.uk> <3A228DA5.9A61BD27@cwcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: oslo-nntp.eunet.no 975464222 12922 195.0.192.66 (29 Nov 2000 02:17:02 GMT) X-Complaints-To: newsmaster@eunet.no NNTP-Posting-Date: 29 Nov 2000 02:17:02 GMT mail-copies-to: never User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7 Xref: supernews.google.com comp.lang.lisp:4408 * Andy Haywood | 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.