"mid" is too specific. A "mean" function may be good as part of a
statistics package. Doesn't seem like a good addition to the core.

How about resorting to algebra and using the commutation

my $middle = floor($l / 2 + $r / 2);

or, if you want to use bit ops and integer math, "$l +> 1 + $r +> 1 +
($l mod 2 + $r mod 2) +> 1"

Though I'm still not convinced that the potential performance hit of
upgrading numbers to avoid an overflow on adding large indexes is
worth the extra operations in the general case.

-y

Reply via email to