in reply to Re: How do I round a number?
in thread How do I round a number?

This concept presented above can be expanded to round to more (or less) percision than just "round number to nearest integer". i.e.

Round to nearest hundred (100):

$rounded=100*int(0.5+$number/100);
Round to nearst tenth (0.1):
$rounded=0.1*int(0.5+$number/0.1);
etc...
  • Comment on RE: Answer: How do i round a generated number in Perl? ...math.round (as in javascript) ...?
  • Select or Download Code