# Formula

Build a math expression by combining operators, functions and numbers you type with fields you drag and drop in. Place number fields anywhere in the expression where there can be a number. At runtime, the expression is evaluated using the values of the fields to generate a single output number.

Operators you can use are:

`+` for addition

`-` for subtraction (or negative)

`*` for multiply

`/` for divide

`^` for power, e.g. 10^2 = 100

`%` for remainder/modulo, e.g. 12%5 = 2

`!` for factorial, e.g. 3! = 6

`#` allows you to add a comment to your expression (anything you type after the # is ignored when the expression is evaluated)

Use parentheses to group operations so they calculate together first.

You can also use standard math functions (with arguments inside parentheses), including:

abs - absolute value - e.g. abs(-10) returns 10

ceil - rounds up to the nearest integer

floor - rounds down to the nearest integer

min - the smallest of a comma separated list of numbers

max - the largest of a comma separated list of numbers

round - rounds to the nearest integer

random - a random number between 0 and a given value, or 1 if followed by empty parentheses - e.g. random(10) or random()

exp - e to the power of a given value

log - the logarithm using base e of a value

log10 - the logarithm using base 10 of a value

pow - the first parameter to the power of the second parameter, e.g. pow(2,3) = 8

sqrt - the square root of a value

pi - the value for pi (use without parentheses)

sin - the sine of an provided angle in radians

cos - the cosine of an provided angle in radians

tan - the tangent of an provided angle in radians

asin - the arcsine of a value between -1 and 1

acos - the arccosine of a value between -1 and 1

atan - the arctangent of a value between -1 and 1

sinh - the hyperbolic sine of a value between -1 and 1

cosh - the hyperbolic cosine of a value between -1 and 1

tanh - the hyperbolic tangent of a value between -1 and 1

You can combine multiple operations, such as:

(pi*(max(10,11,12)^2))+round(random(5))

And number fields (i.e. dropping an output from a previous card into the middle of a calculation) can be used in place of any number value.

For binary arithmetic, use & (bitwise and), ~ (bitwise not), | (bitwise or), ^| (bitwise xor), << (left shift), and >> (right shift).

#### Input Fields

The function has one large input area that accepts a combination of numbers, operators, and math functions you type with number fields you drag/drop in.

#### Output Fields

output - the number that results from evaluating the expression using the values of the fields at runtime.