Hi,

For some reason my sprintf usage is not returning the numbers I had 
expected and appears to be rounding down. Is there something wrong 
with my formatting below.

======= code snip ======

                my ($x,$y) = imgsize($fqn);
                my $size = $x*$y*3;
                my $ksize = sprintf("%.2f",$size/1024); 
                my $mbsize = sprintf("%.2f",$ksize/1024);
                my $msize = sprintf("%d",$mbsize);
                print "$_\t$msize\t$mbsize\n";
================

Output


X3290021                0        0.60
X3290022                0        0.60
X3290023                2       2.32
X3290024                1       1.19
Z2200198                28      28.45
Z2200235                52      52.53
Z3450076                25      25.49
Z4200001                25      25.71

In nearly all of these, I would expect $msize to be rounded up. What 
appears to be happening is that I am getting the int pat of the 
number. What am I doing wrong?

TIA,
Dp.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to