MathGroup Archive 2000

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

Search the Archive

RE: Can you round number to the nearest x?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24912] RE: [mg24871] Can you round number to the nearest x?
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 20 Aug 2000 01:35:00 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Keith,

RoundBy[n_][x_] := n Round[x/n]

RoundBy[5] /@ {-11.2, -3, 0, 3, 11, 22.1, 25, 29}
{-10, -5, 0, 5, 10, 20, 25, 30}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 


> -----Original Message-----
> From: owenzooey at my-deja.com [mailto:owenzooey at my-deja.com]
To: mathgroup at smc.vnet.net
> 
> Looking through the standard functions I cannot find a way to round a
> number to the nearest 5 or 10 or whatever.  Is there a somewhat simple
> way to do this before I do it the hard way?
> 
> Keith
> 
 


  • Prev by Date: Re: Using output of a Fit
  • Next by Date: Re: make matrix animate
  • Previous by thread: Re: Can you round number to the nearest x?
  • Next by thread: make matrix animate