对包含运营位AND(安培)或逐位异或(^)有一个十进制等效? [英] Do operations that contain bit-wise AND (&) or bit-wise exclusive OR(^) have a decimal equivalent?
问题描述
考虑下面的前pressions,其中两个操作数是十进制: A ^ B
或 A和b
Consider the following expressions in which both operand are decimal : a^b
or a&b
我知道运营商的操作数的二进制数字做,因此我知道如何回答
的 A ^ B
或 A和b
的计算方法。
我不知道的是,如果这些操作可以转换为十进制形式
I know what the operators do on binary digits of operands and hence i know how the answer
of a^b
or a&b
is calculated.
What I do not know is if those operations can be translated to decimal form
例如:我们可以说, A<< b
相当于此操作: A *战俘(2,N)
for example : we can say that a<<b
is equivalent to this operation :a*pow(2,n)
是 A ^ B
或 A和b
等同于这样的事情?
Is a^b
or a&b
equivalent to anything like that??
推荐答案
位操作(AND,OR,NOT,XOR)是布尔代数的逻辑延伸。布尔代数上的二进制值(如果你想真/假)进行操作。所以,不,没有扩展为十进制值,该运营商。
Bit operations (AND, OR, NOT, XOR) are logical extensions of Boolean algebra. Boolean algebra operates on binary values (true/false if you want). So no, there is no extension to decimal values, for this operators.
这篇关于对包含运营位AND(安培)或逐位异或(^)有一个十进制等效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!