I know the AND word defines binary and
... but what defines logical and
?
相关问题
- Require explanation for the output
- Logical vs. bitwise operator AND
- 16-bit bitwise and in VHDL?
- Building Jonesforth - asm/unistd.h: No such file o
- Creating a logical variable out of a factor variab
相关文章
- es 单字段多分词器时,textField.keyword无法高亮
- Check for multiple values when using comparison op
- Searching XML Feeds for Keywords
- Use SQL keyword as alias name of a column
- Precedence of Logical Operators in C [duplicate]
- Why is {} < function(){}?
- Does short circuiting make execution of the progra
- What effect does the “new” keyword have in C# and
The same word,
AND
, is also used for logical and. But the two input values toAND
are recommended to be well-formed flags; true and false are represented by two values, bits all set (-1) and bits all unset (0). Other values than these may work as true (as in C), but may lead to subtle errors.All comparison operators return well-formed flags, but for instance
-
does not. The following evaluates to false (0).AND
gets bit patterns 100 and 010. The result is 0 (as it does the bitwise and).References:
The Forth AND is a bit-wise AND on 64 bit values. Of course these operators work okay with masks. But if these values are all ones or all zeroes, the result is also all ones or all zeroes (the same is true for bit-wise OR and XOR INVERT operations.).
A boolean flag in Forth is all ones or all zeroes. So if the inputs are boolean flags, the output of AND OR XOR INVERT are also booleans and those operators can thus be used to represent boolean operators. Please note that operations like = < 0= result in a boolean flag.
The situation is the same with +. Because integers are defined as two-complement, + (plus) can be used for signed as well as unsigned numbers. So there is no separate name for unsigned addition of integers.