It's probably storing your result as 5.999999999999 or something.
Look at this:

=> cat test.pl
my $y = 6;
print $y , "\n";
print sprintf("%04d\n",$y);
print int($y), "\n";
__END__
[intertwingled.net::leontopod::-bash] ~ (Thu Mar 30 14:51:10)
=> perl test.pl
6
0006
6
[intertwingled.net::leontopod::-bash] ~ (Thu Mar 30 14:51:16)

Tony

Wayne Simmons wrote:
-----Original Message-----
From: Wayne Simmons
Sent: Thursday, March 30, 2006 10:36 AM
Subject: persision and perl

my $x = .0006;
my $y = $x * 10000;
print $y , "\n";
print sprintf("%04d\n",$y);
print int($y), "\n";
__END__

-----Original Message-----
From: Christopher Hahn [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 30, 2006 12:34 PM
Subject: RE: persision and perl

Int returns the integer portion --> it truncates!


Great, thanks for filling me in! So 6 truncates to 5 in perl?!? :-0

-Wayne

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs




--

I always have coffee when I watch radar!
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to