At 00:32 +0000 1/23/07, Smylers wrote:
>  % perl -wle 'print 99 / 2'
>  49.5

I would expect the line to return 49 because you surely meant integer division. 
Perl 5 just doesn't have a user-available type integer.

% perl -wle 'print 99.0 / 2.0'   OR
% perl -wle 'print 99.0 / 2'

would return 49.5 because a coercion was required and float is the default for 
such things.

But that may be the mathematician in me. Computers often do things I don't 
expect.

my $numer = 99 as INT;  (You know what I mean.  Perhaps a DIM statement?)
my $denom = 2 as INT;
print  $numer / $denom;
???

-- 
--> If you are presented a number as a percentage, and you do not clearly 
understand the numerator and the denominator involved, you are surely being 
lied to. <--

Reply via email to