Do an arithmetic operation¶
This action takes two variables (that should contain integer values only) and performs an arithmetic operation (such as addition, subtraction...) with their values.
Property Name | Data Type | Description |
---|---|---|
LeftVariable | VarName | Indicates the name of the left variable: its value will be read and "put before" the operator. See below. May be directly an integer and not a variable name. |
Operation | TArithmOperator | Tells the package which arithmetic operation it should execute. A list of possible operations to perform is available by pressing the Down button. See below. |
ResultVar | VarName | The variable that will store the result of the operation. For example %MYRESULT%. |
RightVariable | VarName | Indicates the name of the right variable: its value will be read and "put after" the operator. See below. May be directly an integer and not a variable name. |
Left/Right Variables¶
The package will evaluate the operation like this: Left Variable Operator Right Variable
For example, consider the left variable %LEFT% set to "6", the right variable %RIGHT% set to "4" and the operation is a multiplication: the resulting expression will be 6 x 4. The package will then store "24" in the ResultVar.
Available operations¶
To simplify we will use %LEFT% and %RIGHT% to represent the values of the variables specified by LeftVariable and RightVariable.
Name | Description | Required | Example |
---|---|---|---|
cDoAbsolute | Returns an absolute value | Only LeftVariable is used. | If %LEFT% is set to "-4", the result will be "4". |
cDoAddition | Standard addition | Two variables required. | If %LEFT% is set to "8" and %RIGHT% to "4" the result will be 8+4 = "12". |
cDoIntDivision (div in Pascal) | Integer division: this is the value of %LEFT% / %RIGHT% rounded in the direction of zero to the nearest integer. | Two variables required. RightVariable should not be set to 0! | If %LEFT% is set to "8" and %RIGHT% to "4" the result will be 8/4 = "2". |
cDoMultiplication | Standard multiplication | Two variables required. | If %LEFT% is set to "8" and %RIGHT% to "4" the result will be 8x4 = "32". |
cDoRemainder (mod in Pascal) | Returns the remainder obtained by dividing its operands. In other words, x mod y = x - (x div y) * y . | Two variables required. | If %LEFT% is set to "8" and %RIGHT% to "3" the result will be 8 mod 3 = "2". |
cDoSubstraction | Standard substraction | Two variables required. | If %LEFT% is set to "2" and %RIGHT% to "3" the result will be 2-3 = "-1". |
You may also directly enter an integer as the value for LeftVariable and RightVariable without using a real variable. For example, you can directly enter "3" for RightVariable.
Note that operations are done using 64-bit integers (numbers in [-2^63;2^63[
). For instance you could use this custom action to translate the value returned by the Get Free Disk Space custom action from bytes to MB or GB.