From: Sungwoo, Lim
Subject: Round to the nearest whole number?
Date: 
Message-ID: <271120001453264352%sungwoo@cad.strath.ac.uk>
Hello, I finally back. =)

Is there any function or macro which can "round to the nearest whole
number"?
For example, I want to round from the first decimals as
   3.51 -> 4
   3.4445 -> 3

Thanks for your help.

Sungwoo

From: Rainer Joswig
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <joswig-F9A72B.15565127112000@news.is-europe.net>
In article <··························@cad.strath.ac.uk>, "Sungwoo, 
Lim" <·······@cad.strath.ac.uk> wrote:

> Hello, I finally back. =)
> 
> Is there any function or macro which can "round to the nearest whole
> number"?
> For example, I want to round from the first decimals as
>    3.51 -> 4
>    3.4445 -> 3
> 
> Thanks for your help.
> 
> Sungwoo

? (ROUND 3.51)
4
-0.4900000000000002
? (ROUND 3.4445)
3
0.4445000000000001

-- 
Rainer Joswig, Hamburg, Germany
Email: ·············@corporate-world.lisp.de
Web: http://corporate-world.lisp.de/
From: Sungwoo, Lim
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <271120001510300782%sungwoo@cad.strath.ac.uk>
In article <····························@news.is-europe.net>, Rainer
Joswig <······@corporate-world.lisp.de> wrote:

> In article <··························@cad.strath.ac.uk>, "Sungwoo, 
> Lim" <·······@cad.strath.ac.uk> wrote:
> 
> > Hello, I finally back. =)
> > 
> > Is there any function or macro which can "round to the nearest whole
> > number"?
> > For example, I want to round from the first decimals as
> >    3.51 -> 4
> >    3.4445 -> 3
> > 
> > Thanks for your help.
> > 
> > Sungwoo
> 
> ? (ROUND 3.51)
> 4
> -0.4900000000000002
> ? (ROUND 3.4445)
> 3
> 0.4445000000000001


Oops, @·@;;;; 
The answer was in my question!
Thanks, =)

Sungwoo
From: Andy Haywood
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <3A228DA5.9A61BD27@cwcom.net>
You've got to be careful with round because if number is exactly halfway
between two integers, then it is rounded to the one that is even.

(round 2.5)
=> 2

I would want it to return 3.

Andy
From: Tim Bradshaw
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <nkjelzxmk62.fsf@tfeb.org>
Andy Haywood <···········@cwcom.net> writes:

> You've got to be careful with round because if number is exactly halfway
> between two integers, then it is rounded to the one that is even.
> 
> (round 2.5)
> => 2
> 
> I would want it to return 3.

You probably wouldn't if you did lots of numerical stuff which used
ROUND, as round-upwards can lead to nasty upwards drifts in results.
There's a theorem showing why round-to-even is better by <someone> and
Knuth (or Knuth and <someone>).

(Of course `better' is not really absolute, you can compensate for the
upward drift I think, but it makes things fiddly, especially for
people (like me) who are naive about floating point).

--tim
From: Johan Kullstam
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <m3lmu37tai.fsf@sysengr.res.ray.com>
Andy Haywood <···········@cwcom.net> writes:

> You've got to be careful with round because if number is exactly halfway
> between two integers, then it is rounded to the one that is even.
> 
> (round 2.5)
> => 2
> 
> I would want it to return 3.

for that, you can use floor on 1/2 more.

* (floor (+ 2.5 1/2))
=> 3
   0.0

-- 
J o h a n  K u l l s t a m
[········@ne.mediaone.net]
sysengr
From: Erik Naggum
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <3184450468066295@naggum.net>
* Andy Haywood <···········@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.
From: Thomas A. Russ
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <ymi8zq2zijz.fsf@sevak.isi.edu>
Erik Naggum <····@naggum.net> writes:

>   ... 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.

Actually, there really isn't any rounding scheme which preserves this
invariant, except in some statistical sense.  For example:

 (round (+ 2.2 2.2 2.2 2.2 2.2))
   vs
 (reduce #'= (mapcar #'round '(2.2 2.2 2.2 2.2 2.2)))


-- 
Thomas A. Russ,  USC/Information Sciences Institute          ···@isi.edu    
From: Tim Bradshaw
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <nkjaeahu6yj.fsf@tfeb.org>
···@sevak.isi.edu (Thomas A. Russ) writes:

> 
> Actually, there really isn't any rounding scheme which preserves this
> invariant, except in some statistical sense.  For example:
> 

The statistical sense is what matters though.  You want to try stop
your numerical algorithms drifting off into the sunset if you can.

--tim
From: Harald Hanche-Olsen
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <pcoelzump3v.fsf@thoth.home>
+ Erik Naggum <····@naggum.net>:

|   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.

Unmathematical in what sense?

* (let ((x 2.3) (y 2.4))
    (list '= (+ (round x) (round y)) (round (+ x y))))

(= 4 5)

As a mathematician, I don't call some operations unmathematical if
they fail to commute.

Anyway, round as defined in CL has the very desirable property that if
(+ x y) happens to be an integer, *then* (+ (round x) (round y))
equals (round (+ x y)).  So whether the honest merchant rounds
the value owed before computing your change or computes the change and
then rounds the result, the answer is the same.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Yes it works in practice - but does it work in theory?
From: Barry Margolin
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <54fV5.56$Ha.1119@burlma1-snr2>
In article <···············@thoth.home>,
Harald Hanche-Olsen  <······@math.ntnu.no> wrote:
>Anyway, round as defined in CL has the very desirable property that if
>(+ x y) happens to be an integer, *then* (+ (round x) (round y))
>equals (round (+ x y)).  So whether the honest merchant rounds
>the value owed before computing your change or computes the change and
>then rounds the result, the answer is the same.

But just make sure that you don't buy more than two things at once!

Actually, the "merchant" that this issue often has more of an effect on is
the government, when computing sales tax.  The total tax often differs
depending on whether it's computed on each item or the final total.

-- 
Barry Margolin, ······@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Harald Hanche-Olsen
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <pco4s0pp613.fsf@thoth.home>
+ Barry Margolin <······@genuity.net>:

| In article <···············@thoth.home>,
| Harald Hanche-Olsen  <······@math.ntnu.no> wrote:
| >Anyway, round as defined in CL has the very desirable property that if
| >(+ x y) happens to be an integer, *then* (+ (round x) (round y))
| >equals (round (+ x y)).  So whether the honest merchant rounds
| >the value owed before computing your change or computes the change and
| >then rounds the result, the answer is the same.
| 
| But just make sure that you don't buy more than two things at once!

Actually, what I wrote isn't even true, as the example x=y=2.5 shows
all too clearly.

(unless (improves (quality (usenet-posts me)))
  (revert-to-lurking-mode))

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Yes it works in practice - but does it work in theory?
From: Kent M Pitman
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <sfw8zq2qk93.fsf@world.std.com>
Barry Margolin <······@genuity.net> writes:

> But just make sure that you don't buy more than two things at once!
> 
> Actually, the "merchant" that this issue often has more of an effect on is
> the government, when computing sales tax.  The total tax often differs
> depending on whether it's computed on each item or the final total.

Indeed.  This was a big formative dilemma in my childhood.  I got
$0.25 allowance per week, and comic books cost $0.12 for the small
ones or $0.25 for the large ones, with $0.13 being the point below
which tax was not assessed, so I would buy two $0.12 comic books
separately and save the penny over to buy a $0.25 comic book another
week with its unavoidable $0.01 tax.  This taught me a lot about
careful fiscal management...
From: Espen Vestre
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <w6itp75hah.fsf@wallace.ws.nextra.no>
Erik Naggum <····@naggum.net> writes:

>   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.  

The normal "0.5-rounding rule" isn't as "fraudulent" as it first seems
if you use it for both debit and credit, i.e. if the numbers are 
are evenly distributed around 0.
-- 
  (espen)
From: Robert Monfera
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <3A2716C8.64DC567F@fisec.com>
Though banks' total assets and liabilities equal, deposits (liabilities)
are always much more fragmented, resulting in a higher number of
rounding on the liability side.

Robert

Espen Vestre wrote:

> The normal "0.5-rounding rule" isn't as "fraudulent" as it first seems
> if you use it for both debit and credit, i.e. if the numbers are
> are evenly distributed around 0.
From: Espen Vestre
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <w68zq031ho.fsf@wallace.ws.nextra.no>
Robert Monfera <·······@fisec.com> writes:

> Though banks' total assets and liabilities equal, deposits (liabilities)
> are always much more fragmented, resulting in a higher number of
> rounding on the liability side.

yes, that would mean that in this case the statistical distribution is
'skewed', I guess. My statistics knowledge is too limited (and old) to 
grasp the whole picture here, but roughly, the 'bean counter rule' will
probably be 'fair' for all symmetric distributions (which isn't the case
here) with E=0. The lisp rule will be 'fair' for a much broader class of
statistical distributions (with no _general_ limitation on the expected
value of the distribution), but still not all. 
-- 
  (espen)
From: ········@hex.net
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <wklmu1e55t.fsf@441715.i-did-not-set--mail-host-address--so-shoot-me>
>>>>> "Erik" == Erik Naggum <····@naggum.net> writes:
Erik> * Andy Haywood <···········@cwcom.net> | I would want it to
Erik> return 3.

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

Um, "mathematics" isn't as stringent as you seem to be indicating
here.

It would be _nice_ if the sum of the rounded values should equal the
rounding of the sum of the unrounded values; that isn't necessarily
possible.

After all, suppose we have:
   (defvar values '(2.2 3.2 4.2 5.2))
and want to round to the nearest integer.

[4]> (apply #'+ values)

14.8

The reasonable rounding of that total would be to 15.

The _reasonable_ rounding of the individual values would get you
  (2 3 4 5)
whose sum is 14.

I can't think of a reasonable rounding rule that would round just
_one_ of those four values up so as to satisfy your expectation that:

> (equal (our-round (apply #'+ values))
         (apply #'+ (mapcar #'our-round values)))
T

I don't think that there _is_ a "mathematical operation" to correspond
to our-round.

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

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

Providing a somewhat more elaborate set of examples:

(defparameter *sample1* '(2.2 3.2 4.2 5.2 6.2 7.2 8.2 9.2 10.2))
(defparameter *sample2*
  (list (random 15.2)(random 15.2)(random 15.2)(random 15.2)(random 15.2)
	(random 15.2)(random 15.2)(random 15.2)(random 15.2)(random 15.2))) 

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

(defun round-to-even (number)
  "Rounds to the nearest integer; breaks ties by rounding to a round integer."
  (multiple-value-bind
      (int-part fp-part)
      (truncate number)
    (let ((new-int (cond
		    ((> fp-part 0.5) (+ int-part 1))
		    ((< fp-part 0.5) int-part)
		    (t
		     (if (evenp int-part)
			 int-part
		       (+ int-part 1))))))
      (values new-int (- number new-int)))))

(format t "Round-then-add gives: ~D~%Add-then-round gives: ~D~%"
	(apply #'+ (mapcar #'round-to-even *sample1*))
	(round-to-even (apply #'+ *sample1*)))

(format t "Round-then-add gives: ~D~%Add-then-round gives: ~D~%"
	(apply #'+ (mapcar #'rounding-naggum-penny-theft *sample1*))
	(rounding-naggum-penny-theft (apply #'+ *sample1*)))

(format t "Round-then-add gives: ~D~%Add-then-round gives: ~D~%"
	(apply #'+ (mapcar #'round *sample1*))
	(round (apply #'+ *sample1*)))

(format t "Round-then-add gives: ~D~%Add-then-round gives: ~D~%"
	(apply #'+ (mapcar #'round-to-even *sample2*))
	(round-to-even (apply #'+ *sample2*)))

(format t "Round-then-add gives: ~D~%Add-then-round gives: ~D~%"
	(apply #'+ (mapcar #'rounding-naggum-penny-theft *sample2*))
	(rounding-naggum-penny-theft (apply #'+ *sample2*)))

(format t "Round-then-add gives: ~D~%Add-then-round gives: ~D~%"
	(apply #'+ (mapcar #'round *sample2*))
	(round (apply #'+ *sample2*)))

; Results:
; Round-then-add gives: 54
; Add-then-round gives: 56
; Round-then-add gives: 54
; Add-then-round gives: 56
; Round-then-add gives: 54
; Add-then-round gives: 56
; Round-then-add gives: 65
; Add-then-round gives: 64
; Round-then-add gives: 65
; Add-then-round gives: 64
; Round-then-add gives: 65
; Add-then-round gives: 64

Add-then-round gives different results from Round-then-add for _ALL_
of these rounding policies.  So either they're all "unmathematical,"
or perhaps your expectations are a bit too high...
-- 
(concatenate 'string "cbbrowne" ·@hex.net")
<http://www.ntlug.org/~cbbrowne/>
DO IT -- it's easier to get forgiveness than permission.
From: Rahul Jain
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <90688u$d2g$1@joe.rice.edu>
In article <················@naggum.net> on <················@naggum.net>,
"Erik Naggum" <····@naggum.net> wrote:

>   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

I found myself needing a "penny theft" rounding function when writing a
line rasterizer for a class assignment. Using the more standard rounding
procedure, the lines looked something like:

-
 -
  ---
     -
      -

-- 
-> -\-=-=-=-=-=-=-=-=-=-/^\-=-=-=<*><*>=-=-=-/^\-=-=-=-=-=-=-=-=-=-/- <-
-> -/-=-=-=-=-=-=-=-=-=/ {  Rahul -<>- Jain   } \=-=-=-=-=-=-=-=-=-\- <-
-> -\- "I never could get the hang of Thursdays." - HHGTTG by DNA -/- <-
-> -/- http://photino.sid.rice.edu/ -=- ·················@usa.net -\- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   Version 11.423.999.210020101.23.50110101.042
   (c)1996-2000, All rights reserved. Disclaimer available upon request.
From: Stefan Simbuerger t2002
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <wqyg0k3n810.fsf@rphs55.physik.uni-regensburg.de>
Path: uni-regensburg.de!news-nue1.dfn.de!uni-erlangen.de!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 <····@naggum.net>
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: <················@naggum.net>
References: <··························@cad.strath.ac.uk> <····························@news.is-europe.net> <··························@cad.strath.ac.uk> <·················@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: ··········@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: uni-regensburg.de comp.lang.lisp:45623

* Erik Naggum
| 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.

What do you mean by "unmathematical"?  A function in mathematics, say f,
is usually defined as a mapping from some set S to some number field R
in a way as to assign every x from S to some f(x) from R.  Note that f
does not necessarily have to be _homomorphic_ (if S has no + operation
this is clear from the outset), i.e. in general f(x+y) /= f(x)+f(y)
holds.

Stefan
From: Erik Naggum
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <3184962203555403@naggum.net>
* Stefan Simbuerger
| What do you mean by "unmathematical"?

  An exaggeration intended to be so blatantly exaggerated that it would
  at least seem somewhat humorous to at least one person beside myself.
  With a rounding function called "penny-theft" and words like "less
  rebelliously", I'm _amazed_ that not a single soul could lighten up.
  
#:Erik, sighing
-- 
  "When you are having a bad day and it seems like everybody is trying
   to piss you off, remember that it takes 42 muscles to produce a
   frown, but only 4 muscles to work the trigger of a good sniper rifle."
								-- Unknown
From: Harald Hanche-Olsen
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <pcosno2lc5w.fsf@thoth.home>
+ Erik Naggum <····@naggum.net>:

| * Stefan Simbuerger
| | What do you mean by "unmathematical"?
| 
|   An exaggeration intended to be so blatantly exaggerated that it would
|   at least seem somewhat humorous to at least one person beside myself.
|   With a rounding function called "penny-theft" and words like "less
|   rebelliously", I'm _amazed_ that not a single soul could lighten up.

Well, mathematicians of course have no sense of humour, since humour
cannot be expressed in Zermelo-Fraenkel set theory.  Not to mention
that humour (the good kind) is usually self-referential, and this
would tie us into some kind of G�delian knot if we tried it.

Lispers thrive on self-reference of course, since lambda calculus has
no problems dealing with it.  So they're always full of fun.  Which is
why I lurk (most of the time) on this newsgroup, trying to figure out
what this humour thing is all about.

I'll bet it isn't all it's cracked up to be, though.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Yes it works in practice - but does it work in theory?
From: ········@hex.net
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <7BhX5.46545$IP1.1576384@news1.giganews.com>
Erik Naggum <····@naggum.net> writes:
> * Stefan Simbuerger
> | What do you mean by "unmathematical"?
>
>   An exaggeration intended to be so blatantly exaggerated that it
>   would at least seem somewhat humorous to at least one person
>   beside myself.  With a rounding function called "penny-theft" and
>   words like "less rebelliously", I'm _amazed_ that not a single
>   soul could lighten up.
>
> #:Erik, sighing

You think that the long presentation was intended to be
heavy-hearted?!?  [Besides which, based on the pretty dramatically
different understandings of "abusive" that people have on this
newsgroup, why would it be reasonable to expect a common understanding
of humour?]

>   "When you are having a bad day and it seems like everybody is trying
>    to piss you off, remember that it takes 42 muscles to produce a
>    frown, but only 4 muscles to work the trigger of a good sniper rifle."
> 								-- Unknown

Actually, _that_ quote is likely attributable to my little brother,
Brad...  I don't know that he was the _first_ to say it, but say it,
I'm sure he has.  Last time I went shooting, it was at the trigger of
a "good sniper rifle..."
-- 
(concatenate 'string "cbbrowne" ·@hex.net") <http://www.ntlug.org/~cbbrowne/>
As usual,  this being  a 1.3.x release,  I haven't even  compiled this
kernel yet.   So if it works,  you should be  doubly impressed. (Linus
Torvalds, announcing kernel 1.3.3 on the linux-kernel mailing list.)
From: Erik Naggum
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <3185062877156149@naggum.net>
* Christopher Browne
| [Besides which, based on the pretty dramatically different
| understandings of "abusive" that people have on this newsgroup, why
| would it be reasonable to expect a common understanding of humour?]

  Because it's a much simpler concept, even though both are essentially
  destructive in nature and it is always hard to agree on what should be
  destroyed because of the complexity of the concept of justice..  Those
  who object to "abusive" out of a gut feeling do not object to "humor",
  even though the latter is sometimes more destructive.  E.g., nobody
  has arrested that ridiculously pompous nincompoop Marcus G.  Daniels
  for any of his attempts at purely destrucdtive "humor", but if anyone
  is abusive towards the expectation of respect for _people_ in this
  forum, he's your best bet.  Light-heartedness is something other than
  humor, though.  And lightening up is the opposite of pompousness.

#:Erik
-- 
  "When you are having a bad day and it seems like everybody is trying
   to piss you off, remember that it takes 42 muscles to produce a
   frown, but only 4 muscles to work the trigger of a good sniper rifle."
								-- Unknown
From: Geoffrey Summerhayes
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <sQjX5.50510$2A2.2386320@news20.bellglobal.com>
"Erik Naggum" <····@naggum.net> wrote in message
·····················@naggum.net...
> And lightening up is the opposite of pompousness.

Odd. You would think being full of hot air would have a tendency to cause
lightness...

Geoff
From: ········@hex.net
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <wkitp5dxok.fsf@441715.i-did-not-set--mail-host-address--so-shoot-me>
>>>>> "Andy" == Andy Haywood <···········@cwcom.net> writes:

    Andy> You've got to be careful with round because if number is
    Andy> exactly halfway between two integers, then it is rounded to
    Andy> the one that is even.

    Andy> (round 2.5) => 2

    Andy> I would want it to return 3.

It's fair enough to say that someone rounding the price of a product
after doing tax calculations might prefer to round up if, at all
possible, so as to charge the customer as much as possible.

The "round an exact-half to the nearest even value" is the convention
I've always seen in science courses, and is a good policy if you don't
want bias.
-- 
(concatenate 'string "cbbrowne" ·@ntlug.org")
<http://www.ntlug.org/~cbbrowne/>
Rules of the Evil Overlord #15. "I will never employ any device with
a digital countdown. If I find that such a device is absolutely
unavoidable, I will set it to activate when the counter reaches 117
and the hero is just putting his plan into operation."
<http://www.eviloverlord.com/>
From: Thomas A. Russ
Subject: Re: Round to the nearest whole number?
Date: 
Message-ID: <ymielzxz32h.fsf@sevak.isi.edu>
round

-- 
Thomas A. Russ,  USC/Information Sciences Institute          ···@isi.edu