in reply to counter-intuitive sprintf behaviour

Have a look at the output of the following code, then you'll understand. The problem is with the conversion of literals to floating point numbers, there 1.005 might in fact be 1.004999999999 which rounds to 1.00:
for( 0..9 ) { my $num0 = "1.$_"; my $num1 = "1.0$_"; my $num2 = "1.00$_"; printf "$num0 => %0.0f $num1 => %0.1f $num2 => %0.2f\n", $num0, $num1, $num2; printf "$num0 => %0.20f $num1 => %0.20f $num2 => %0.20f\n", $num0, $num1, $num2; print "\n"; }

-- Hofmator