00010 REM LOGFUN.BAS - Logical functions
00020 REM FNA(p,q) - p AND q
00030 REM FNN(p) - NOT p
00040 REM FNO(p,q) - p OR q
00050 DEF FNA(P,Q)=-1*P*Q
00060 DEF FNN(P)=-1*P-1
00070 DEF FNO(P,Q)=SGN(P+Q)
00080 PRINT "Logical Function Truth Table (0: false, -1: true)"
00090 PRINT
00100 PRINT "p","q","p AND q","p OR q","NOT p"
00110 FOR I=0 TO -1 STEP -1
00120 FOR J=0 TO -1 STEP -1
00130 PRINT I,J,FNA(I,J),FNO(I,J),FNN(I)
00140 NEXT J
00150 NEXT I
00160 END