Am 15.07.2010 12:24, schrieb Todd Olson:
Hi
At 20:11 +0200 2010-07-14, Moritz Lenz wrote:
I'll also fix some minor nits, like simplifying
my $middle = $l + floor( ($r-$l)/2);
to
my $middle = floor ($r + $l) / 2
???
!!!
Thinking more about it,
my $middle = ($r + $l) div 2
is even better.
If it ever were the case that $r + $l could produce an overflow
Then we really have other problems. Remember that $r and $l are array
indexes. If your machine has enough memory to hold an array and a hash
of the same size in memory, but can't store integers long enough to
index them, you're basically screwed.
Also Int numbers are specified to transparently upgrade to bigints if
necessary, so that's hardly a problem in Perl 6.
Cheers,
Moritz