in reply to math with decimals
Do you mean it doesn't display trailing zeroes in the decimals? You can add them using sprintf:
$num = 64; $num = sprintf('%.2f', $num); print($num, "\n"); # Prints 64.00
Note that %f rounds:
$num = 123.456; $num = sprintf('%.2f', $num); print($num, "\n"); # Prints 123.46
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: math with decimals
by GrandFather (Saint) on Nov 24, 2005 at 00:51 UTC |