On 1/22/07, Doug McNutt <[EMAIL PROTECTED]> wrote:


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.


That doesn't mean that I surely meant integer division. Being used to how
Perl 5 (and many other languages) do things, I would expect floating point
division (though if it's not floating point beneath the covers that's fine
with me as long as I can still get 49.5 out).

% 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.


I don't see why the mathematician in you doesn't expect "regular"
mathematical behavior from Perl.  Perhaps it's that you've been using
computers too long and have become used to the limitations of digital media.

-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to