| |
|
|
p.specht
| in the of George Boole begründeten zweiwertigen Logik there only true and wrong. what but, if one it simply not yet decide can, but so far weiterarbeiten should, as even on reason the Datenlage already possible is? then needed one instead of two even three values: Hinzu comes the worth "M" (engl. Maybe: Perhaps, möglicherweise, kann_sein/wäre_erlaubt/weiss_nicht").
an Rosettacode-task [...] claims now The suitable realization this dreiwertigen Logikfunktionen, The I in nachfolgenden 3NOT(), 3AND(), 3OR(), 3XOR(), 3Equ() for Gleichheitsfunktion and 3Imp() for Implikationsfunktion (If a then b) called have. tappt im dunkeln lying now in XProfan-11 to, where I the in the Literatur verwendeten worth "M" or "?" through "2" approach have. 0 remaining furthermore "false" and 1 furthermore "true/true). worth watts on The Logiknormierung laid: one Funktionswert 0 or 2 remaining receive, eachone others worth becomes logical true = 1 normiert. The functions harren now of/ one reasonable application.
Windowtitle "Ternäre (Dreiwertige) Logikfunktionen"
Cls
proc 3val :parameters a%
case a%=0:return 0
case a%=2:return 2
return 1
endproc
proc 3hardship :parameters a%
case a%=2:return 2
return hardship(a%)
endproc
proc 3and :parameters a%,b%
if a%=0
return 0
elseif a%=2
case b%=0:return 0
return 2
else
return 3val(b%)
endif
endproc
proc 3or :parameters a%,b%
if a%=0
return 3val(b%)
elseif a%=2
case (b%=0) or (b%=2):return 2
return 1
else
return 1
endif
endproc
proc 3Equ :parameters a%,b%
if a%=0
return 3hardship(b%)
elseif a%=2
return 2
else
return 3val(b%)
endif
endproc
proc 3xor :parameters a%,b%
if a%=0
return 3val(b%)
elseif a%=2
return 2
else
return 3hardship(b%)
endif
endproc
proc 3Imp :parameters a%,b%
if a%=0:return 1
elseif a%=2
case b%=1:return 1
return 2
else
return 3val(b%)
endif
endproc
Test:
appendmenubar 100," 0 = false (F), 1 = true (T), ?=2: "+\
"weiss-not/möglicherweise/allows/kann_sein/Perhaps (M, Maybe)"
declare a%,b%
print
print " -------------------------------"
print " a b not_a and or xor <=> ==>"
whileloop 0,4,2:a%=3val(&Loop)
whileloop 0,4,2:b%=3val(&Loop)
print " -------------------------------"
print " |",a%,b%,"|",3hardship(a%),"|",3and(a%,b%),"|",3or(a%,b%),"|",
print 3xor(a%,b%),"|",3Equ(a%,b%),"|",3Imp(a%,b%),"|"
endwhile
endwhile
print " -------------------------------"
beep
waitinput
End
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/29/21 ▲ |
|
|
|