Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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