[Coco] replicating bitwise operators in BASIC
Dave Philipsen
dave at davebiz.com
Fri Sep 9 13:19:10 EDT 2016
Well, actually NAND _is_ NOT and AND. And you can actually do it all
with just NAND.
On 9/9/2016 8:21 AM, Brett Gordon wrote:
> Ok.. i'll one-up you all: you can do it all with either NAND or XOR.
> Although things get pretty hideous (but possible) to do either in the other!
>
> cheers, brett
> On Sep 9, 2016 8:15 AM, "Dave Philipsen" <dave at davebiz.com> wrote:
>
>> Actually the XOR could be constructed out of just AND and NOT.
>>
>>
>>
>>
>> On 9/8/2016 11:09 PM, Barry Nelson wrote:
>>
>>> The operators AND, OR, and NOT work fine.
>>>
>>> Example
>>>
>>> PRINT 3 AND 2
>>>
>>> outputs 2
>>> and
>>>
>>> PRINT 1 OR 2
>>>
>>> outputs 3
>>>
>>> The XOR operator can be constructed out of AND, OR, and NOT.
>>>
>>> Brett Gordon beretta42 at gmail.com
>>>> Thu Sep 8 23:54:22 EDT 2016
>>>> BASIC gurus:
>>>>
>>>> In noodling with Jim's test code for the CoCoNIC, I realized the lack of
>>>> bitwise AND, XOR, OR, etc. in coco BASIC. What's the orthodox way of
>>>> replicating these operators that are so customary in other languages? I
>>>> remember loads of head scratching in Lua, which like our BASIC, also
>>>> lacks
>>>> basic bitwise functions and converts all numbers to floats.
>>>>
>>>> brett
>>>>
>>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco
>>
More information about the Coco
mailing list