逻辑与在Forth? [英] Logical AND in Forth?

查看:87
本文介绍了逻辑与在Forth?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道AND字定义了二进制and ...,但是什么定义了逻辑and?

I know the AND word defines binary and... but what defines logical and?

推荐答案

相同的词AND也用于逻辑.但是,建议AND的两个输入值是格式正确的标志 true false 由两个值表示,位全部置为(-1),位全部未置为(0).除此以外的其他值可能都适用(如C中所述),但可能会导致细微的错误.

The same word, AND, is also used for logical and. But the two input values to AND 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.

所有比较运算符均返回格式正确的标志,但例如,-则不返回.以下结果为假(0).

All comparison operators return well-formed flags, but for instance - does not. The following evaluates to false (0).

7 5 - 7 3 - AND

AND的位模式为100和010.结果为0(按位的一样).

AND gets bit patterns 100 and 010. The result is 0 (as it does the bitwise and).

参考文献:

  1. Forth中的位操作,是 Learning Forth Bit的一部分按位.
  2. 第4章 em>起步.
  1. Bit Manipulations in Forth, part of Learning Forth Bit by Bit.
  2. Section "A Little Logic" in Chapter 4 of Starting Forth.

这篇关于逻辑与在Forth?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆