Calculation
Calculation can be devided into arithmetic calculation, relative calculation and logic calculation.
Arithmetic calculation includes four fundamental calculation, index calculation and getting-remainder calculation. Following is various kinds of calculation.
Arithmetic Calculation
|
Calculation Content
|
Example
|
Mathatic Express
|
+
|
Addition Calculation
|
A+B
|
A+B
|
-
|
Subtraction Calculation
|
A-B
|
A-B
|
*
|
Multiplication Calculation
|
A*B
|
A×B or AB
|
/
|
Division Calculation
|
A/B
|
A÷B or A/B
|
^
|
Index Calculation
|
A^B
|
A^B
|
Mod
|
Mod Calculation
|
A mod B
|
A-[A/B]×B
[]is Gauss symbol
|
Devision 0 calculation will be wrong.
Do addition calculation, subtraction calculation and multiplication calculation. If result overstep -1.0e30 to 1.0e30, then it will be wrong.
Relative calculation is comparatively calculation of two numerical data or two character data. If comparatively result is true, return -1, alse return 0.
Following is all kinds of relative calculation.
Relative Calculation
|
Content
|
Example
|
=
|
Equal
|
A=B
|
<>,><
|
Not Equal
|
A<>B,A><B
|
<
|
Less Than
|
A<B
|
>
|
More Than
|
A>B
|
<=,=<
|
Less Than or Equal
|
A<=B,A=<B
|
>=,=>
|
More Than or Equal
|
A>=B,A=>B
|
Relative calculation is used in compare between two values. If result is true, return -1, also return 0.
Logic calculation can be used to check more than one condition or operate with bit to designated value. Following is all kinds of logic calculation.
Logic Calculation
|
Content
|
Example
|
Not
|
Non
|
not A
|
And
|
Logic And
|
A and B
|
Or
|
Logic Or
|
A or B
|
Xor
|
Xor
|
A xor B
|
Logic calculation can be used to check more than one condition or operate with bit to designated value. We can use "or" calculation to make special bit 1. We also can use "and" calculation to make special bit 0.
The priority of calculation is as follow.
1
|
()
|
2
|
Function
|
3
|
Index Calculation(^)
|
4
|
Minus(-)
|
5
|
Multiplication or Division(*,/)
|
6
|
Mod Calculation(Mod)
|
7
|
Addition or Subtraction(+,-)
|
8
|
Relative Calculation(<,>,=and so on)
|
9
|
Not
|
10
|
And
|
11
|
Or
|
12
|
Xor
|