MathGroup Archive 1996

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

Search the Archive

Re: Round[1.5] != Round[3/2] = 2 ???

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3501] Re: Round[1.5] != Round[3/2] = 2 ???
  • From: rhall2 at umbc.edu (hall robert)
  • Date: Mon, 18 Mar 1996 00:58:06 -0500
  • Organization: University of Maryland, Baltimore County
  • Sender: owner-wri-mathgroup at wolfram.com

In article <4ibblj$fep at ralph.vnet.net>,
Peter Foldiak  <Peter.Foldiak at st-andrews.ac.uk> wrote:
>On my Unix (SG) version of Mathematica I get this strange
>behaviour:

	[snip]

>The book says "Round rounds numbers of the form x.5 towards 0."
>Well, sometimes, it appears. Am I doing something wrong or is this a
>bug?

For rational numbers, Round[] rounds to the even integer.

In[5]:=
     Round[ 3/2 ]
Out[5]=
     2
In[6]:=
     Round[ 5/2 ]
Out[6]=
     2

But in the alternative universe of decimal fractions, 
Round[] rounds toward 0, as stated in
"Mathematica: A System for Doing Ontology by Computer."

In[2]:=
     Round[ 3/2 // N ]
Out[2]=
     1
In[7]:=
     Round[ 5/2 // N ]
Out[7]=
     2

Thus, reality depends on which universe you occupy.

-- 
Bob Hall            | "Know thyself? Absurd direction!
rhall2 at gl.umbc.edu  |  Bubbles bear no introspection."  -Khushhal Khan Khatak

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Re-evaluation of Conditional expressions
  • Next by Date: Problem: Prompt 'INPUT' disappears
  • Previous by thread: Round[1.5] != Round[3/2] = 2 ???
  • Next by thread: mathematica vs.mathcad vs. maple