Calculates the value of a math expression or formula.
Expression
— A math expression or formula, for example:
Width / 0,75
or Width / 0.75
avg(A; B; C)
or avg(A, B, C)
PI * R^2
Area = Width * Height
Values
— The numbers to substitute in place of the variables in Expression
.Result
— The number calculated from Expression
.If your computer is set up for a region (such as most of Europe and South America) that uses a comma as the decimal mark, then you should also use commas (“,”) as decimal marks for this node, and you should use semicolons (“;”) to separate lists of numbers or variables. Otherwise (for regions such as China and the United States), you should use periods (“.”) as decimal marks, and you should use commas (“,”) to separate lists of numbers or variables.
The math expression may contain one or more input variables — names like Distance
, Time
, or A
that are replaced with the numbers in Values
.
Optionally, the math expression may contain an output variable — a name for the calculated result, to help you remember what it represents. If there’s an output variable, the math expression should have a =
sign (assignment operator) with the output variable on the left and the input variables on the right. For example, in the expression Area = Width * Height
, the output variable is Area
and the input variables are Width
and Height
.
The math expression may also contain:
PI
— π, approximately 3.14(
and )
a + b
— additiona - b
— subtractiona * b
— multiplicationa / b
— divisiona^b
— power/exponenta % b
— modulusa < b
— less thana > b
— greater thana <= b
— less than or equala >= b
- greater than or equala == b
— equala != b
— not equala && b
— logical anda || b
— logical ora ? b : c
— if-then-else, for example: Score > 100 ? Bonus : 0
sqrt(n)
— square rootexp(n)
— the mathematical constant e raised to a powerln(n)
— logarithm to base elog(n)
or log10(n)
— logarithm to base 10log2(n)
— logarithm to base 2round(n)
or rint(n)
— round to the nearest integerfloor(n)
/ ceil(n)
— round to the nearest smaller/larger integertrunc(n)
— round to the nearest integer with a smaller magnitudefract(n)
— returns the fractional partabs(n)
— absolute valuesign(n)
— -1 if negative, 1 if positivedeg2rad(n)
— convert degrees to radiansrad2deg(n)
— convert radians to degreesavg(a,b,…)
— average of a list of numberssum(a,b,…)
— sum of a list of numbersmin(a,b,…)
— minimum of a list of numbersmax(a,b,…)
— maximum of a list of numbersrandom(min,max)
— random numberclamp(n,min,max)
— constrains n to be >= min and <= maxstep(edge,n)
— returns 0 if n < edge, or 1 if n > edgesmoothstep(edge0,edge1,n)
— returns a smooth 0 to 1 value as n changes from edge0 to edge1mix(a,b,t)
— linearly interpolate between a and b, at position t (0 to 1)perlin1d(x)
perlin2d(x,y)
perlin3d(x,y,z)
perlin4d(x,y,z,w)
simplex1d(x)
simplex2d(x,y)
simplex3d(x,y,z)
simplex4d(x,y,z,w)
sin(n)
, cos(n)
, tan(n)
asin(n)
, acos(n)
, atan(n)
, atan2(y,x)
sinh(n)
, cosh(n)
, tanh(n)
asinh(n)
, acosh(n)
, atanh(n)
Keywords: %, &&, *, +, -, /, <, <=, ==, >, >=, ^, abs, acos, acosh, add, and, asin, asinh, atan, atan2, atanh, avg, compare, condition, cos, cosh, difference, divide, equal, equation, exp, expression, formula, greater, if, less, ln, log, log10, log2, logic, mathematics, maths, max, min, minus, modulus, multiply, or, pi, power, product, quotient, rint, sign, sin, sinh, sqrt, subtract, sum, tan, tanh, trigonometry, x, ×, •