Speaking of which, it would be nice if 3!:4 had options for converting
unsigned numbers into J numbers.  (It supports 2 byte numbers, but not
other common sizes.)

Obviously, this would require picking a type of number which can
represent the full range of values, but J has those types.

-- 
Raul



On Fri, Dec 30, 2011 at 1:15 PM, Raul Miller <rauldmil...@gmail.com> wrote:
> That is ambiguous, in the general case.
>
> Practically speaking, however, it's defined by context.  If the data
> is "signed" the most significant bit is a "negative bit".  If the data
> is "unsigned" the most significant bit is a "binary digit".
>
> That said, some operations are useful regardless of this distinction
> (which was the motivation for using this representation).  For
> example, if you have implemented addition, you can use the same
> addition implementation for both "signed" and "unsigned" data.  The
> mechanics are the same, only the symbolism differs.
>
> --
> Raul
>
> On Thu, Dec 29, 2011 at 11:00 PM, Linda Alvord <lindaalv...@verizon.net> 
> wrote:
>>   How can you tell when the leading digit is a "negative bit"  or a "binary
>> digit"?
>>
>>  In the situation above the same number can represent two different binary
>> numbers. If  1 1 0 1 is sometimes  13  or might be   _5  when is each
>> appropriate?v. Isn't that the source of some problems?
>>
>> The spaces indicate that the number is probably a single binary number, but
>> it could be a list of true and false indicators. You would need to know the
>> context to determine the difference.
>>
>> Linda
>>
>> -----Original Message-----
>> From: programming-boun...@jsoftware.com
>> [mailto:programming-boun...@jsoftware.com] On Behalf Of Kip Murray
>> Sent: Thursday, December 29, 2011 8:25 PM
>> To: Programming forum
>> Subject: Re: [Jprogramming] How #: should have been designed
>>
>>
>>    tcrRaul }: i:4
>> 1 0 0
>> 1 0 1
>> 1 1 0
>> 1 1 1
>> 0 0 0
>> 0 0 1
>> 0 1 0
>> 0 1 1
>>
>>    tcrRandy }: i:4
>> 1 1 0 0
>> 1 1 0 1
>> 1 1 1 0
>> 1 1 1 1
>> 0 0 0 0
>> 0 0 0 1
>> 0 0 1 0
>> 0 0 1 1
>>
>>    tcrRaul
>> {.@#:@(,: (2 * >./@,))
>>
>>    tcrRandy
>> (0 > ]) ,"0 1 #:
>>
>>
>> On 12/29/2011 8:41 AM, Randy MacDonald wrote:
>>> On 12/8/2011 4:39 PM, Raul Miller wrote:
>>>> {.@#:@(,: 2 *>./@,)i:2
>>> ((0>]),"0 1#:) i:2   NB. seems to work just as well, and more obviously
>>> handles the sign bit.
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> 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