Math functions
Functions for performing mathematical operations.
Abs
Abs(value) -> Number
Function bundle: Core
Returns the absolute value of a number. If the input is null
, then it returns 0.
Parameter
- value: Number - A number on which to perform the operation.
Return value: Number
Example
prints 3
Acos
Acos(value) -> Number
Function bundle: Core
Returns the arccosine of the input value in radians, in the range of zero to PI. If the input value is outside the appropriate range of +/- 1, then NaN is returned.
Parameter
- value: Number - A number between -1 and 1 on which to perform the operation.
Return value: Number
Example
prints 1.266104
Asin
Asin(value) -> Number
Function bundle: Core
Returns the arcsine of the input value in radians, in the range of -PI/2 and PI/2. If the input value is outside the appropriate range of +/- 1, then NaN is returned.
Parameter
- value: Number - A number between -1 and 1 on which to perform the operation.
Return value: Number
Example
prints 0.304693
Atan
Atan(value) -> Number
Function bundle: Core
Returns the arctangent of the input value in radians, in the range of -PI/2 and PI/2.
Parameter
- value: Number - A number on which to perform the operation.
Return value: Number
Example
prints 0.785398
Atan2
Atan2(y, x) -> Number
Function bundle: Core
Returns the arctangent of the quotient of the input values in radians, in the range of -PI and zero or zero and PI depending on the sign of arguments.
Parameters
- y: Number - A number representing the y-coordinate.
- x: Number - A number representing the x-coordinate.
Return value: Number
Example
prints -2.356194
Average
This function has 2 signatures:
Average(numbers) -> Number
Function bundle: Core
Returns the average of an array of numbers.
Parameter
Return value: Number
Example
prints 5
Average([number1, ..., numberN]?) -> Number
Function bundle: Core
Returns the average of a list of numbers.
Parameter
- [number1, ..., numberN] (Optional): Number - A list of numbers on which to perform the operation.
Return value: Number
Example
prints 5
Ceil
Ceil(value, numPlaces?) -> Number
Function bundle: Core
Returns the input value rounded upwards to the given number of decimal places.
Parameters
- value: Number - The number to round upward.
- numPlaces (Optional): Number - The number of decimal places to round the
value
to. Default is 0. Trailing zeros will be truncated.
Return value: Number
Example
prints 2135.1
Constrain
Constrain(value, lowerBound, upperBound) -> Number
Function bundle: Core
Constrains the given input value
to minimum and maximum bounds. For example, if the input value is 10
, the lower bound is 50
, and the upper bound is 100
, then 50
is returned.
Parameters
- value: Number - The value to constrain to the given
min
andmax
bounds. - lowerBound: Number - The lower bound by which to constrain the input
value
. If the given value is less than themin
, thenmin
is returned. - upperBound: Number - The upper bound by which to constrain the input
value
. If the given value is greater than themax
, thenmax
is returned.
Return value: Number
Examples
returns 5
returns 0
returns 10
Cos
Cos(value) -> Number
Function bundle: Core
Returns the cosine of the input value in radians.
Parameter
- value: Number - A number in radians on which to perform the operation.
Return value: Number
Example
prints 0.540302
Exp
Exp(x) -> Number
Function bundle: Core
Returns the value of e to the power of x, where e is the base of the natural logarithm 2.718281828
.
Parameter
- x: Number - The power, or number of times to multiply
e
to itself.
Return value: Number
Example
prints 7.389056
Floor
Floor(value, numPlaces?) -> Number
Function bundle: Core
Returns the input value rounded downward to the given number of decimal places.
Parameters
- value: Number - A number to round downward.
- numPlaces (Optional): Number - The number of decimal places to round the number. Default is 0. Trailing zeros will be truncated.
Return value: Number
Example
prints 2316.25
Hash
Hash(value) -> Number
Function bundle: Core
Generates a hash code value for the given variable.
Parameter
- value: Text | Number | Boolean | Date | Array<Any> | Dictionary | Geometry - The variable to be hashed.
Return value: Number
Example
Returns 1649420691
.
Log
Log(x) -> Number
Function bundle: Core
Returns the natural logarithm (base e) of x.
Parameter
- x: Number - A number on which to perform the operation.
Return value: Number
Example
prints 2.302585
Max
This function has 2 signatures:
Max(numbers) -> Number
Function bundle: Core
Returns the largest value from an array of numbers.
Parameter
Return value: Number
Example
prints 89
Max([number1, ..., numberN]?) -> Number
Function bundle: Core
Returns the largest value from a list of numbers.
Parameter
- [number1, ..., numberN] (Optional): Number - A list of numbers.
Return value: Number
Example
prints 120
Mean
This function has 2 signatures:
Mean(numbers) -> Number
Function bundle: Core
Returns the mean value of an array of numbers.
Parameter
Return value: Number
Example
Mean([number1, ..., numberN]?) -> Number
Function bundle: Core
Returns the mean value of a list of numbers.
Parameter
- [number1, ..., numberN] (Optional): Number - A list of numbers from which to calculate the mean.
Return value: Number
Example
Min
This function has 2 signatures:
Min(numbers) -> Number
Function bundle: Core
Returns the lowest value in a given array of numbers.
Parameter
Return value: Number
Example
prints 23
Min([number1, ..., numberN]?) -> Number
Function bundle: Core
Returns the lowest value in a given list of numbers.
Parameter
- [number1, ..., numberN] (Optional): Number - A list of numbers.
Return value: Number
Example
prints 5
Number
Number(value, pattern?) -> Number
Function bundle: Core
Converts the input value to a number. Date values will be converted to the number of milliseconds since Jan. 1, 1970 (i.e. the Unix epoch).
Parameters
value: Any - The value to convert to a number.
pattern (Optional): Text - The format pattern text used to parse numbers formatted in a localized context from a text value to a number. The following are special characters used to define the pattern:
- 0: Mandatory digits
- #: Optional digits
- %: Divide by 100
Return value: Number
Examples
Parses a number using a grouping separator appropriate for the local in which the expression is executed
Remove text characters from number.
Specify minimum digits past 0 as two and maximum digits past 0 as 4.
Specify minimum digits past 0 as two and maximum digits past 0 as 4. The left and right side of the function must match or NaN is returned.
Indicate the size of the repeated group and the final group size of the input value.
If there is a negative subpattern, it serves only to specify the negative prefix and suffix.
Divide by 100. Maximum of three decimal places can be input.
Returns the number of milliseconds since Jan. 1, 1970.
Pow
Pow(x, y) -> Number
Function bundle: Core
Returns the value of x to the power of y.
Parameters
- x: Number - The base value.
- y: Number - The exponent. This indicates the number of times to multiply
x
by itself.
Return value: Number
Example
prints 9
Random
Random() -> Number
Function bundle: Core
Returns a random number between 0 and 1.
Return value: Number
Example
Round
Round(value, numPlaces?) -> Number
Function bundle: Core
Returns the input value, rounded to the given number of decimal places.
Note: If you're looking to format a value for display in a label or popup, use the text function.
Parameters
- value: Number - A number to round.
- numPlaces (Optional): Number - The number of decimal places to round the number to. Default is
0
. Trailing zeros will be truncated.
Return value: Number
Example
prints 2316.26
Sin
Sin(value) -> Number
Function bundle: Core
Returns the sine of the input value.
Parameter
- value: Number - A number in radians on which to perform the operation.
Return value: Number
Example
prints 0.841741
Sqrt
Sqrt(value) -> Number
Function bundle: Core
Returns the square root of a number.
Parameter
- value: Number - A number on which to calculate the square root.
Return value: Number
Example
prints 3
Stdev
This function has 2 signatures:
Stdev(numbers) -> Number
Function bundle: Core
Returns the standard deviation (population standard deviation) of aan array of numbers.
Parameter
Return value: Number
Example
prints 27.5
Stdev([number1, ..., numberN]?) -> Number
Function bundle: Core
Returns the standard deviation (population standard deviation) of a list of numbers.
Parameter
- [number1, ..., numberN] (Optional): Number - An list of numbers on which to perform the operation.
Return value: Number
Example
prints 27.5
Sum
This function has 2 signatures:
Sum(numbers) -> Number
Function bundle: Core
Returns the sum of an array of numbers.
Parameter
Return value: Number
Example
prints 303
Sum([number1, ..., numberN]?) -> Number
Function bundle: Core
Returns the sum of a list of numbers.
Parameter
- [number1, ..., numberN] (Optional): Number - A list of numbers on which to perform the operation.
Return value: Number
Example
prints 303
Tan
Tan(value) -> Number
Function bundle: Core
Returns the tangent of an angle in radians.
Parameter
- value: Number - A number on which to calculate the tangent.
Return value: Number
Example
prints 0.57389
Variance
This function has 2 signatures:
Variance(numbers) -> Number
Function bundle: Core
Returns the variance (population variance) of an array of numbers.
Parameter
Return value: Number
Example
prints 756.25
Variance([number1, ..., numberN]?) -> Number
Function bundle: Core
Returns the variance (population variance) of a list of numbers.
Parameter
- [number1, ..., numberN] (Optional): Number - An array of numbers on which to perform the operation.
Return value: Number
Example
prints 756.25