当前位置:网站首页>The difference between the operators and logical operators
The difference between the operators and logical operators
2022-08-05 05:25:00 【Xmn_】
Bitwise operators include four kinds of '&' , ' ~' , '| ', '^'.
Bit operation is to first convert the data to two's complement form, and then gradually calculate bit by bit.Where
"~" is the "bitwise NOT" operator, the rule: 1 is 0, 0 is 1.
"&" is the "bitwise AND" operator, the rule: all 1s are 1, otherwise it is 0.
"^" is the "bitwise XOR" operator, the rule: the same is 0, the difference is 1.
"|" is the "bitwise OR" operator, the rule: all 0 are 0, otherwise it is 1.Such as:
Calculate 3|6=x
3 0011
6 | 0110
x 0111=7
So 3|6=7.
Note:
The bitwise XOR operation is reversible, that is, if the same XOR operation is performed on a certain data a twice, the result will be restored to a, such as the value 3 and 5 are performed twiceXOR:
3 ^ 5 = 6;
6 ^ 5 = 3;
Logical operatorThere are three kinds of
'&&' , and logical AND
'||' , logical OR
'!', logical NOT
The operation rules are as follows:

Summary the difference between the two
1) Logical operators can only perform calculations on Boolean types, but bit operations can perform logical operations on numerical values.
2) There is a short circuit phenomenon in logical operators, that is, when the previous expression is judged to be successful, the latter expression will not be executed.

边栏推荐
- 学习总结day5
- The software design experiment four bridge model experiment
- [Redis] Resid的删除策略
- redis 持久化
- 【过一下8】全连接神经网络 视频 笔记
- Database experiment five backup and recovery
- Difference between for..in and for..of
- [Let's pass 14] A day in the study room
- [Go through 4] 09-10_Classic network analysis
- [Go through 3] Convolution & Image Noise & Edge & Texture
猜你喜欢
![[Go through 8] Fully Connected Neural Network Video Notes](/img/0a/8b2510b5536621f402982feb0a01ef.png)
[Go through 8] Fully Connected Neural Network Video Notes

【过一下14】自习室的一天

The fourth back propagation back propagation

Using pip to install third-party libraries in Pycharm fails to install: "Non-zero exit code (2)" solution
![[Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)](/img/86/9c9a2541f2b7089ae47e9832fffdb3.png)
[Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)

拿出接口数组对象中的所有name值,取出同一个值

The underlying mechanism of the class

Calling Matlab configuration in pycharm: No module named 'matlab.engine'; 'matlab' is not a package

Wise Force Deleter强制删除工具

A blog clears the Redis technology stack
随机推荐
HQL statement execution process
Error creating bean with name 'configDataContextRefresher' defined in class path resource
pycharm中调用Matlab配置:No module named ‘matlab.engine‘; ‘matlab‘ is not a package
【技能】长期更新
Returned object not currently part of this pool
序列基础练习题
学习总结week2_5
【过一下12】整整一星期没记录
小白一枚各位大牛轻虐虐
Calling Matlab configuration in pycharm: No module named 'matlab.engine'; 'matlab' is not a package
[Go through 4] 09-10_Classic network analysis
Flink HA安装配置实战
flink实例开发-batch批处理实例
OFDM Lecture 16 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems
redis复制机制
第四讲 反向传播随笔
软件设计 实验四 桥接模式实验
Flink accumulator Counter 累加器 和 计数器
学习总结week2_4
机器学习(一) —— 机器学习基础