MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why Round[5/2]=2?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17487] Re: Why Round[5/2]=2?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 10 May 1999 01:44:26 -0400
  • References: <7h4j9n$ei9@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Xing Jing Li <xingjing at calvin.math.vt.edu> wrote in message
news:7h4j9n$ei9 at smc.vnet.net...
> While  I am working on the exercises on the book _Power Programming
> with Mathematica_ I noticed that Round[5/2] gave me 2. It is obviously
> wrong. But how could this happen? I am using Mathematica 3.0.1 on a
> Macintosh. I also tried the command"Round[5/2]" on other Macintoshes
> and PCs and all them gave me 2. Is this some kind bug? Other numbers I
> tried gave me the answers I expected.
>
> Can some one tell me what is going on?
>
> Thanks,
>
> Xing Jing Li
>

Xing Jing Li,

The Help Browser tells  us  that:

Round[x] gives the integer closest to x.
Round rounds numbers of the form x.5 toward the nearest even integer

This is consistent with what you found.

But I seem to remember that some rounding rules use   x.5  rounds up  if x
is even and down it x is odd (or vice versa).


Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565




  • Prev by Date: Re: Plotting Problem
  • Next by Date: Re: inequalities ... HELP!
  • Previous by thread: Re: Why Round[5/2]=2?
  • Next by thread: Re: Why Round[5/2]=2?