MathGroup Archive 2002

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

Search the Archive

Re: Rounding numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37037] Re: [mg37002] Rounding numbers
  • From: BobHanlon at aol.com
  • Date: Mon, 7 Oct 2002 05:24:12 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 10/6/2002 7:39:38 AM, delouis at bellsouth.net writes:

>Could somebody please inform me how to Round numbers to a
>certain Accuracy using Mathematica 4.2.  This is not as easy as it
>sounds.
>Every function that I have read Rounds the Display, and not the actual
>number.

myRound[x_, n_] := Round[10^n*x]/10.^n;

Table[myRound[Random[], 3], {10}]

{0.044, 0.019, 0.738, 0.298, 0.917, 0.171, 0.021, 0.314, 
  0.658, 0.153}


Bob Hanlon


  • Prev by Date: RE: Solve a(over)b in mathematica?
  • Next by Date: RE: Plotting ellipses and other functions
  • Previous by thread: Rounding numbers
  • Next by thread: Re: Rounding numbers