Eqv: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== Operator == | |||
''result = x | ''result = x Eqv y'' | ||
== Description == | |||
Eqv returns the logical equivalence of two expressions. ''result'' is TRUE, if both expressions ''x'' and ''y'' evaluate to TRUE or both expressions ''x'' and ''y'' evaluate to FALSE, otherwise, result is FALSE. | |||
Eqv also does a bitwise comparison of two numeric expressions. Each bit in result is set to 1 if both corresponding bits in ''x'' and ''y'' are 1 or both corresponding bits in ''x'' and ''y'' are 0, otherwise it is set to 0. | |||
== Example == | |||
<pre> | <pre> | ||
REM | REM Eqv Example | ||
' | 'Eqv performs logical and bitwiseequivalence | ||
DIM Test1, Test2, Test3, x, y | DIM Test1, Test2, Test3, x, y | ||
x = 4 | x = 4 | ||
y = 9 | y = 9 | ||
Test1 = x < 0 | Test1 = x < 0 Eqv y < 10 | ||
Test2 = x > 0 | Test2 = x > 0 Eqv y > 10 | ||
Test3 = x < 0 | Test3 = x < 0 Eqv y > 10 | ||
PRINT "Logical:" | PRINT "Logical:" | ||
PRINT " x < 0 | PRINT " x < 0 Eqv y < 10 = " & Test1 | ||
PRINT " x > 0 | PRINT " x > 0 Eqv y > 10 = " & Test2 | ||
PRINT " x < 0 | PRINT " x < 0 Eqv y > 10 = " & Test3 | ||
</pre> | </pre> | ||
== Output == | |||
<pre> | <pre> | ||
Logical: | Logical: | ||
x < 0 | x < 0 Eqv y < 10 = False | ||
x > 0 | x > 0 Eqv y > 10 = False | ||
x < 0 | x < 0 Eqv y > 10 = True | ||
</pre> | </pre> | ||
== Related Items == | |||
[[and|AND]], [[imp|IMP]], [[not|NOT]], [[or|OR]], [[xor|XOR]] | [[and|AND]], [[imp|IMP]], [[not|NOT]], [[or|OR]], [[xor|XOR]] |
Revision as of 21:00, 8 August 2012
Operator
result = x Eqv y
Description
Eqv returns the logical equivalence of two expressions. result is TRUE, if both expressions x and y evaluate to TRUE or both expressions x and y evaluate to FALSE, otherwise, result is FALSE.
Eqv also does a bitwise comparison of two numeric expressions. Each bit in result is set to 1 if both corresponding bits in x and y are 1 or both corresponding bits in x and y are 0, otherwise it is set to 0.
Example
REM Eqv Example 'Eqv performs logical and bitwiseequivalence DIM Test1, Test2, Test3, x, y x = 4 y = 9 Test1 = x < 0 Eqv y < 10 Test2 = x > 0 Eqv y > 10 Test3 = x < 0 Eqv y > 10 PRINT "Logical:" PRINT " x < 0 Eqv y < 10 = " & Test1 PRINT " x > 0 Eqv y > 10 = " & Test2 PRINT " x < 0 Eqv y > 10 = " & Test3
Output
Logical: x < 0 Eqv y < 10 = False x > 0 Eqv y > 10 = False x < 0 Eqv y > 10 = True