Post Reply 
(33s) Implementation of NOT Function
08-09-2022, 08:19 AM
Post: #1
(33s) Implementation of NOT Function
Takes any number N from stack and returns NOT(N).
Any number of absolute value not zero returns zero,
zero returns one.
Preserves stack.

Can anyone find a more economical version while preserving the stack?

Code:
1.    LBL N
2.    STO H
3.    CLx
4.    1-ABS(SGN(H))
5.    RTN

N: LN = 28
Find all posts by this user
Quote this message in a reply
09-03-2022, 04:07 AM (This post was last modified: 09-23-2022 08:31 AM by Gerald H.)
Post: #2
RE: (33s) Implementation of NOT Function
YES!

But not good for small values, eg input of 0.00000001.

Code:
1.    LBL N
2.    COS
3.    IP
4.    RTN

N: LN = 12

But fastest is

Code:
1.    LBL N
2.    SGN
3.    ABS
4.    STO H
5.    CLx
6.    1
7.    RCL- H
8.    RTN

N: LN = 36
Find all posts by this user
Quote this message in a reply
09-22-2022, 12:19 PM
Post: #3
RE: (33s) Implementation of NOT Function
It's fascinating to see a trig function in one of the codes.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)