$xx = 12000/1000; # wanted result is 12.0 $yy = 12678/1000; # wanted result is 12.7 - rounded up