The "embarassing" example happens because the full scope of "two's
complement" notation implies fixed-width binary numbers, not the
variable-width version given in this thread.

On Wed, Dec 14, 2011 at 10:41 AM, Kip Murray <k...@math.uh.edu> wrote:

> On 12/14/2011 6:07 AM, Linda Alvord wrote:
> > I really don't think that you can ever write a program good enough that
> the
> > the number  8 in binary is _8 in decimals
> >
> >       hcinv 1 0 0 0
> >    _8
>
> THAT /IS/ EMBARRASSING !
>
> > I have lived my mathematical life without being able to write negative
> > binary numbers. I have always ignored two's complements as beyond my
> scope
> > of interest.  It is like saying there are no negative numbers.  It will
> be
> > ok  if  13  stands for  _13  and we'll all be happy.
> >
> > I'm sure that much of the world deals well without  imaginary numbers.
> > However, they must have been a mess to develop so they work flawlessly.
> > Note that they do have a strange appearance but if you understand them
> you
> > get used to them.
> >
> > In my world, if I want  _8  I write  _1 0 0 0  which  is  in  the  8 4 2
> 1
> > 8's digit.   So what is  _14 ?
>  >
> > Linda
>
> IN YOUR WORLD _14 IS
>
>     - 1 1 1 0
>  _1 _1 _1 0
>
> AND IN TWO'S-COMPLEMENT IT IS
>
>     tcng 0 1 1 1 0
>  1 0 0 1 0
>
>  ------------------
>
>  stack =: ,.&.|:  NB. stack x over y
>
>  hv =: (0 {:: <"1) :: ]  NB. return head vector
>
>   Tbln =: 2 2 2 $ 0 0,1 1,1 1,0 1  NB. table for tcng, see opn
>
>  ban =: 0 ,~ 0 ,.~ 0 ,.~ ]  NB. build argument, see tcng
>
>  opn =: ] stack~ (0 { [) , Tbln {~ [: < (0 { [) ,~ 2 { [: hv ]
>
>  tcng =: (1 {"1 [: }: [: opn/ ban)"1  NB. TWO'S-COMPLEMENT NEGATIVE
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to