On Mon, 22 Jun 2015 17:58:46 -0700 Jan Dubois <jand@activestate.com> wrote: > > shift left by negative n == shift right by -n ? > > shift right by negative n == shift left by -n? > > Yes, that's what I would expect a high-level language to do. > > It also means that $a << $b == $a * 2**$b, even for negative $b, which > is again something I naively expect. :) > > I believe I once wrote $a << ($p-$q) and expected this generalized > behaviour, but can't remember any context. SGTM. This sort of DWIMery feels like the right approach, especially in cases like your << ($p-$q). ((In fact I think I already have one of those in a piece of C code I recently wrote, that probably only works because $p is known larger than $q in my case and both are compiletime constants.)) -- Paul "LeoNerd" Evans leonerd@leonerd.org.uk http://www.leonerd.org.uk/ | https://metacpan.org/author/PEVANSThread Previous | Thread Next