Page 1 of 1
NOR in BASIC
Posted: Thu Jul 28, 2022 7:13 pm
by Jeff-20
Can someone help me out with a simple BASIC formula for logical NOR? I tried OR then AND255. What would you use?
If you're up for the challenge, what about NAND? XNOR?
Re: NOR in BASIC
Posted: Thu Jul 28, 2022 7:56 pm
by groepaz
what about NOT (A OR B)
Re: NOR in BASIC
Posted: Fri Jul 29, 2022 12:24 am
by Mike
what groepaz wrote, plus:
NAND(A,B) -> NOT(A AND B)
XNOR(A,B) -> A=B ("=" as relational operator, as in IF A=B THEN ...) provided A and B are -1 for true and 0 for false.
NOT(A AND B) also works for bitwise operations (where A and B are not necessarily 0 or -1). XNOR(A,B) would need to be expressed as (A AND B) OR (NOT A AND NOT B) in that case.
Re: NOR in BASIC
Posted: Fri Jul 29, 2022 1:46 am
by TRIANGULAR OS
If you want have this in 0 or 1 form use ABS() function in BASIC. So for example XNOR(A,B) would be ABS(A=B), if you want 0,1 answer.
Re: NOR in BASIC
Posted: Fri Jul 29, 2022 11:43 am
by Jeff-20
Great info! Thank you!