Arithmetic operators and logical operators in the batch processing set command, for beginners to see
DOS writing Batch processing writing Meaning of the symbol and range of values
Bitwise XOR: num1^^num2 num1^^num2 Convert to 2's complement binary, judge bit by bit, different is 1, same is 0, convert to decimal output,
Bitwise AND: num1^&num2 num1^&num2 Convert to 2's complement binary, judge bit by bit, all 1s is 1, otherwise 0, convert to decimal output
Bitwise OR: num1^|num2 num1^|num2 Convert to 2's complement binary, judge bit by bit, all 0s is 0, otherwise 1, convert to decimal output
Addition: num1+num2 num1+num2
Subtraction: num1-num2 num1-num2
Multiplication:num1*num2 num1*num2
Division: num1/num2 num1/num2 The result is truncated towards zero, num2 is not 0
Remainder: num1%num2 num1%%num2 num2 is not 0, when num2 is negative, treat it as the same absolute value positive number, when num2 is negative, calculate as positive, then take the negative of the result
Bitwise NOT: ~num ~num Convert to binary, 1 becomes 0, 0 becomes 1, output in decimal form of 2's complement
Logical NOT: !num !num Output 1 if num is 0, output 0 if not 0
Negation: -num -num
Logical left shift: num1^<^<num2 num1^<^<num2 Convert to 2's complement binary, all bits of num1 are shifted left by num2 digits, fill several 0s at the back, convert to decimal output, output 0 if num2 is negative
Logical right shift: num1^>^>num2 num1^>^>num2 Convert to 2's complement binary, all bits of num1 are shifted right by num2 digits, convert to decimal output, output 0 if num2 is negative
DOS writing Batch processing writing Meaning of the symbol and range of values
Bitwise XOR: num1^^num2 num1^^num2 Convert to 2's complement binary, judge bit by bit, different is 1, same is 0, convert to decimal output,
Bitwise AND: num1^&num2 num1^&num2 Convert to 2's complement binary, judge bit by bit, all 1s is 1, otherwise 0, convert to decimal output
Bitwise OR: num1^|num2 num1^|num2 Convert to 2's complement binary, judge bit by bit, all 0s is 0, otherwise 1, convert to decimal output
Addition: num1+num2 num1+num2
Subtraction: num1-num2 num1-num2
Multiplication:num1*num2 num1*num2
Division: num1/num2 num1/num2 The result is truncated towards zero, num2 is not 0
Remainder: num1%num2 num1%%num2 num2 is not 0, when num2 is negative, treat it as the same absolute value positive number, when num2 is negative, calculate as positive, then take the negative of the result
Bitwise NOT: ~num ~num Convert to binary, 1 becomes 0, 0 becomes 1, output in decimal form of 2's complement
Logical NOT: !num !num Output 1 if num is 0, output 0 if not 0
Negation: -num -num
Logical left shift: num1^<^<num2 num1^<^<num2 Convert to 2's complement binary, all bits of num1 are shifted left by num2 digits, fill several 0s at the back, convert to decimal output, output 0 if num2 is negative
Logical right shift: num1^>^>num2 num1^>^>num2 Convert to 2's complement binary, all bits of num1 are shifted right by num2 digits, convert to decimal output, output 0 if num2 is negative
Recent Ratings for This Post
( 1 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| everest79 | +11 | 2008-02-11 16:36 |
