You might also want to take a look at floor and ceil$unrounded=0.66666; $rounded=sprintf("%.2f",$a) #$rounded is rounded to 2 decimal places + and is equal to 0.67 printf("$unrounded rounded to 3 decimal places is %.3f\n",$unrounded +);
In reply to How do I round a floating point number? by vroom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |