bit shifting corresponds to multiplying or dividing by powers of two.

   shift=: ] * 2 ^ [
   1 shift 3x
6

Though you may prefer
   intshift=: ] <.@* 2 ^ [
   1 intshift 3x
6
   _1 intshift 3x
1

Thanks,

-- 
Raul


On Sat, Jan 31, 2015 at 9:30 AM, Jon Hough <[email protected]> wrote:
> It seems in J I cannot use the bitshift operator
> shift =: 33 b.
> on integers larger than 32 bit unsigned integers (i.e. 2^31).
>
> e.g. 1 shift (<: 2^31) has a result
> but
> 1 shift 2^31
> gives a domain error.
>
> Is there anyway to perform bitshifting operations on large (extended ?) 
> integers in J?
> One possible, although I suppose slow, way is to truncate the binary 
> representation of the integer
> (i.e. after using #:) and append zeros on the end.
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to