Matlab 자바 의 "와 비"

1308 단어 Matlab
Matlab:
Logical Operators: Short-Circuit && ||
expr1 && expr2
expr1 || expr2
1 & 256 // result is 1
1 & 255 // result is 1

   expr1 && expr2 represents a logical AND operation that employs short-circuiting behavior. That is, expr2 is not evaluated if expr1 is logical 0 (false). expr1 || expr2 represents a logical OR operation that employs short-circuiting behavior. That is, expr2 is not evaluated if expr1 is logical 1 (true).
and, &​​​​​​​
A & B
and(A,B)  
1 & 256 // result is 1
1 & 255 // result is 1 

   A & B performs a logical AND of arrays A and B and returns an array containing elements set to either logical 1 (true) or logical 0 (false).
bitand
 C = bitand(A,B)
 C = bitand(A,B,assumedtype)
 1 & 256 // result is 0
 1 & 255 // result is 1

Java:
& & | | | 모두 비트 조작
1 & 256 // result is 0
1 & 255 // result is 1

참고:https://www.mathworks.com/help/matlab/ref/logicaloperatorsshortcircuit.html https://www.mathworks.com/help/matlab/ref/and.html https://www.mathworks.com/help/matlab/ref/bitand.html?s_tid=doc_ta https://stackoverflow.com/questions/5564410/difference-between-and

좋은 웹페이지 즐겨찾기