MathGroup Archive 2000

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

Search the Archive

RE: Can you round number to the nearest x?


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