Re: [Jprogramming] twos complement

2015-11-12 Thread bill lam
x27;"_`(_1:)@.(_1 = *) , #:) _3 > _1 0 1 > > #: inv _1 0 1 > _3 > > > > > > - Original Message - > From: Raul Miller > To: Programming forum > Cc: > Sent: Thursday, November 12, 2015 4:50 PM > Subject: Re: [Jprogramming] twos complement

Re: [Jprogramming] twos complement

2015-11-12 Thread 'Jon Hough' via Programming
I noticed hfd / dfh have similar problems. dfh hfd _17 239 On Fri, 11/13/15, Raul Miller wrote: Subject: Re: [Jprogramming] twos complement To: "Programming forum" Date: Friday, November 13, 2015, 8:03 AM On Thu, Nov 12, 2015 a

Re: [Jprogramming] twos complement

2015-11-12 Thread Raul Miller
On Thu, Nov 12, 2015 at 5:37 PM, 'Pascal Jasmin' via Programming wrote: > I don't know if your original post had a typo, but it reported 1 0 1. 1 0 1 would unambiguously be -3. -- Raul -- For information about J forums see http

Re: [Jprogramming] twos complement

2015-11-12 Thread 'Pascal Jasmin' via Programming
4:50 PM Subject: Re: [Jprogramming] twos complement On Thu, Nov 12, 2015 at 12:45 PM, 'Pascal Jasmin' via Programming wrote: > Your version creates an encoding of _3 that is identical to 5. Which might > be a problem when inverting. I disagree. sbits _3 5 1 1 0 1 0 1 0 1 The firs

Re: [Jprogramming] twos complement

2015-11-12 Thread Raul Miller
On Thu, Nov 12, 2015 at 12:45 PM, 'Pascal Jasmin' via Programming wrote: > Your version creates an encoding of _3 that is identical to 5. Which might > be a problem when inverting. I disagree. sbits _3 5 1 1 0 1 0 1 0 1 The first bit is 1 for negative integers and 0 for positive integers.

Re: [Jprogramming] twos complement

2015-11-12 Thread 'Pascal Jasmin' via Programming
Here is an alternative, that could seem more useful to me. ( ''"_`(_"_)@.(_1 = *) , #:@|) _3 _ 1 1 ( ''"_`(_"_)@.(_1 = *) , #:@|) 3 1 1 Your version creates an encoding of _3 that is identical to 5. Which might be a problem when inverting. there is also this traditional encoding where 31 coul

Re: [Jprogramming] twos complement

2015-07-27 Thread Dan Bron
I wrote: > >:@<.@^. 1 >. >./@:|@, Raul responded: > Personally, I prefer the fork 1 + u over the perhaps more obvious >:@u In general I agree with you, but in this case I like the sequence of inflected arrows*: >: @ <. @ ^. It’d be cuter if >: happened to be spelled >. but I still like it

Re: [Jprogramming] twos complement

2015-07-27 Thread Raul Miller
Personally, I prefer the fork 1 + u over the perhaps more obvious >:@u Other than that, I kind of like your ndr. Thanks, -- Raul On Mon, Jul 27, 2015 at 11:47 AM, Dan Bron wrote: > > Raul wrote: >> twosC=: #:~ 2 #~ 1 + {:@$@#: > > The clause {:@$@#: does a lot of work (computationally speak

Re: [Jprogramming] twos complement

2015-07-27 Thread Dan Bron
Raul wrote: > twosC=: #:~ 2 #~ 1 + {:@$@#: The clause {:@$@#: does a lot of work (computationally speaking, not notationally speaking) to determine the number of bits required. There is a cheaper way. But the problem with “cheaper ways” is I always have to come up with them and then teach J