MathGroup Archive 2007

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

Search the Archive

Re: Re: Outputting to file with fixed decimal digits

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75321] Re: [mg75285] Re: Outputting to file with fixed decimal digits
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Wed, 25 Apr 2007 05:34:34 -0400 (EDT)
  • References: <f0ekbt$pnn$1@smc.vnet.net> <200704240719.DAA27260@smc.vnet.net>

do.not at reply.nonet wrote:
> Larry
> [...]
> 
> I have suggested using the "Floor" function - it's to avoid the
> "Round" function which has the most bizarre definition in Mathematica
> - it doesn't give the same answer every time.
> (Look in "Further Examples" in the Help on "Round")
> It's one reason that makes me think Mathematica is not really
> "Engineering Grade" software and suspicious that there may be more
> weird things that I just haven't come across yet.
> 
> Robert

Here is what I find in Help > Round > Further Examples from version 5.2.

---------------
To avoid statistical bias Round alternates between going up and down 
halfway between integers.

In[1]:=
Round[Range[10]+.5]

Out[1]=
{2,2,4,4,6,6,8,8,10,10}

The function NumericRound rounds all parts of the numeric coefficients 
of a polynomial.

In[2]:=
NumericRound[x_]:=MapAll[If[NumericQ[#],Round[#],#]&,x]

In[3]:=
\!\(NumericRound[\@\[Pi] + \((\[ExponentialE] + a)\)\ x + \((4.3 -
             8.6  \[ImaginaryI]\ )\) x\^3]\)

Out[3]=
\!\(1 + \((3 + a)\)\ x + \((4 - 9\ \[ImaginaryI])\)\ x\^3\)

In[4]:=
Clear[NumericRound]
---------------

I do not see examples that show changes to their results upon repetition.


Daniel Lichtblau
Wolfram Research



  • Prev by Date: simplification
  • Next by Date: Re: CrossProduct in Spherical Coordinates
  • Previous by thread: Re: Re: Outputting to file with fixed decimal digits
  • Next by thread: Re: Outputting to file with fixed decimal digits