Hi.. I've run into a bit of whackiness that I'm at a loss to explain, I've tried this on 3 different machines (all running some flavor of linux), and the behaviour repeats. Perhaps I'm incorrect in my use of printf, but I've found nothing indicating this..
I'm attempting to round a number to 2 decimal places:
my (@numbers) = qw( 0.256 0.255 0.254 );
printf("%0.2f\n", $_) foreach @numbers;
I'd expect results like:
But what I'm seeing are results like:
Notice the 1.25
vs 1.26 that I'd expect..
As I said, I'm confused.. feel free to smite me down if I've pulled some kind of noob mistake.