P is for Practical | |
PerlMonks |
Re: How do I print/round a number to a given number of decimal places?by Roy Johnson (Monsignor) |
on Nov 04, 2003 at 16:04 UTC ( [id://304457]=note: print w/replies, xml ) | Need Help?? |
This other answer, by wrvhage, has the great property of working correctly for values like 3.005 rounded to two places (where sprintf is not). However, it needs a couple of tweaks to work for negative numbers.
In Section
Seekers of Perl Wisdom
|
|