Description
Calculate math expressions using placeholders and an array of values.
Properties
Triggers Immediately
Expression | A math expression. E.g 1 + 3. Use %d as a placeholder for integers and %f as a placeholder for decimals. See the table below for a full list of place holders. |
Values | An array of values used to populate the placeholders in your expression. |
Outputs
Result | The result of evaluation the expression |
Error | If the expression is malformed this will contain the error message. |
Examples
- Compute the addition of two integers %d + %d with values [1, 5].
- Compute the math expression 5 * 3.
- Multiply two floating point numbers %f * %f with values [3.2, 4.7].
- Use the value from the array behaviour for the values input.
- Round up e^3 by doing ceiling:(exp(3))
Functions
Function |
Description |
Example Usage |
---|---|---|
|
Add one value to an other |
add:to(1, 2) produces 3 |
|
Subtract one value from another | from:subtract:(5, 2) produces 3 |
|
Multiply one value by another. |
multiply:by:(6, 3) produces 18 |
|
Divide one value by another. |
divide:by:(10, 2) produces 5 |
|
Perform a modulus operation. |
modulus:by:(9, 2) produces 1 |
abs: |
Get the absolute value. |
abs:(-1) produces 1. |
sqrt: |
Get the square root of a value. |
sqrt:(16) produces 4. |
log: |
Evaluate the log_10 of a value. |
log:(100) produces 2 |
ln: |
Evaluate the natural logarithm/log_e of a value. |
ln:(3) produces 1.09861228866811 |
raise:toPower: |
Raise one value to the power of another. |
raise:toPower:(2, 5) produces 32 |
exp: |
Evaluates e^x. |
exp:(1) = e^1 = 2.718281828459045 |
ceiling: |
Evaluate the ceiling function (round up). |
ceiling:(1.23) produces 2 |
trunc: |
Truncate a value (round down). |
trunc:(1.23) produces 1 |
random |
Get a random value between 0 and 1. E.g random() |
random() |
bitwiseAnd:with: |
Perform the bitwise And operator on two values |
bitwiseAnd:with:(1, 0) produces 0 |
bitwiseOr:with: |
Perform the bitwise Or operator on two values |
bitwiseOr:with:(1, 0) produces 1 |
bitwiseXor:with: |
Perform the bitwise Xor operator on two values |
bitwiseXor:with:(5, 3) produces 6 |
leftshift:by: |
Perform a left shift operation on the first value by the second |
leftshift:by:(1,5) produces 32 |
rightshift:by: |
Perform a right shift operation on the first value by the second |
rightshift:by:(2,1) produces 1 |
onesComplement: |
Perform the ones complement (swap the ones and zeros of the binary representation of a number) |
onesComplement:(5) produces 2 |
now |
Get the current date and time |
now() produces 2020-11-27 19:30:31 +0000 at the time of writing this |
Placeholders (String format specifiers)
Specifier |
Description |
---|---|
|
Objective-C object, printed as the string returned by |
|
The |
|
Signed 32-bit integer ( |
|
Unsigned 32-bit integer ( |
|
Unsigned 32-bit integer ( |
|
Unsigned 32-bit integer ( |
|
Unsigned 32-bit integer ( |
|
64-bit floating-point number ( |
|
64-bit floating-point number ( |
|
64-bit floating-point number ( |
|
64-bit floating-point number ( |
|
64-bit floating-point number ( |
|
8-bit unsigned character ( |
|
16-bit UTF-16 code unit ( |
|
Null-terminated array of 8-bit unsigned characters. Because the |
|
Null-terminated array of 16-bit UTF-16 code units. |
|
Void pointer ( |
|
64-bit floating-point number ( |
|
64-bit floating-point number ( |
|
64-bit floating-point number ( |
0 Comments