On Tue, Nov 08, 2011 at 11:02:39AM -0800, Noah wrote:
> Hi there,
> 
> I am trying to round to 10 or 100 for particular values
> 
> so the following numbers
> 530
> 570
> 2330
> 2590
> 3630
> 3660
> 
> would become
> 500
> 600
> 2300
> 2600
> 3600
> 3700
> 
> any clues how to do this well?

The usual trick is to do something like

  $r = int($n / 100 + .5) * 100;

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to