Now that we can do binary representation without #: or #. please write a two's-complement representation tcr without using #: or #. .
tcr _2 1 0 tcr i: 2 1 1 0 1 1 1 0 0 0 0 0 1 0 1 0 A straightforward two's-complement value tcv explains the two's complement representation: tcv =: ([: (2 p.~ |.) -@{. , }.)"1 NB. two's-complement value tcv tcr _2 _2 tcv tcr i: 2 _2 _1 0 1 2 Kip ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm