2.315 rounded is 2.31#!/usr/bin/perl $w=2.315; $x=2.3150141; $y=sprintf("%.2f", $w); $z=sprintf("%.2f", $x); print "$w rounded is $y\n"; print "$x rounded is $z\n";
In reply to Re^2: sprintf and decimals
by nosbod
in thread sprintf and decimals
by nosbod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |