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

???

If it ever were the case that $r + $l could produce an overflow
then the second statement would fail, while the first would work.
Perhaps it would be better to keep the first statement?

(To be concrete consider what happens if numbers are encoded in unsigned 3 bits.
 Then, when $r = 7 and $l = 1, the first statement computes a result
 while the second statement fails with overflow when computing $r + $l => 8
)

Regards,
Todd Olson

Reply via email to