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
Abs(-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
Acos(0.3)
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
Asin(0.3)
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
Atan(1)
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
Atan2(-1, -1)
Average
This function has 2 signatures:
- Since v1.0 - Average(numbers) -> Number
- Since v1.0 - Average([number1, ..., numberN]?) -> Number
Average(numbers) -> Number
Function bundle: Core
Returns the average of an array of numbers.
Parameter
Return value: Number
Example
prints 5
var values = [0,5,10]
Average(values)
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
Average(0,5,10)
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
Ceil(2135.0905, 2)
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
Constrain(5, 0, 10)
returns 0
Constrain(-3, 0, 10)
returns 10
Constrain(553, 0, 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
Cos(1)
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
Exp(2)
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
Floor(2316.2562, 2)
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 | DateOnly | Time - The variable to be hashed. DateOnly and Time values are supported starting at version 1.24.
Return value: Number
Example
Returns 1649420691
.
Hash('text value')
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
Log(10)
Max
This function has 2 signatures:
- Since v1.0 - Max(numbers) -> Number
- Since v1.0 - Max([number1, ..., numberN]?) -> Number
Max(numbers) -> Number
Function bundle: Core
Returns the largest value from an array of numbers.
Parameter
Return value: Number
Example
prints 89
Max([23,56,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
Max(23,5,120,43,9)
Mean
This function has 2 signatures:
- Since v1.1 - Mean(numbers) -> Number
- Since v1.1 - Mean([number1, ..., numberN]?) -> Number
Mean(numbers) -> Number
Function bundle: Core
Returns the mean value of an array of numbers.
Parameter
Return value: Number
Example
var values = [1,2,3,4,5,6,7,8,9];
Mean(values);
// returns 5
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
Mean(1,2,3,4,5,6,7,8,9);
// returns 5
Min
This function has 2 signatures:
- Since v1.0 - Min(numbers) -> Number
- Since v1.0 - Min([number1, ..., numberN]?) -> Number
Min(numbers) -> Number
Function bundle: Core
Returns the lowest value in a given array of numbers.
Parameter
Return value: Number
Example
prints 23
Min([23,56,89])
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
Min(23,5,120,43,9)
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
Number('1,365', ',###') // returns 1365
Remove text characters from number.
Number('abc10def', 'abc##def') // return 10
Specify minimum digits past 0 as two and maximum digits past 0 as 4.
Number('10.456','00.00##') // returns 10.456
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.
Number('10.4','00.00##') // returns NaN
Indicate the size of the repeated group and the final group size of the input value.
Number('12,12,456', ',##,###') // returns 1212456
If there is a negative subpattern, it serves only to specify the negative prefix and suffix.
Number('-12,23,345', ',##,###;-,##,###') // returns -1223345
Divide by 100. Maximum of three decimal places can be input.
Number('99.99%', '#.##%') // 0.9999
Returns the number of milliseconds since Jan. 1, 1970.
Number(Date(1996,11,10)) // returns 850204800000
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
Pow(3, 2)
Random
Random() -> Number
Function bundle: Core
Returns a random number between 0 and 1.
Return value: Number
Example
Random()
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
Additional resources
Example
prints 2316.26
Round(2316.2562, 2)
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
Sin(1)
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
Sqrt(9)
Stdev
This function has 2 signatures:
- Since v1.0 - Stdev(numbers) -> Number
- Since v1.0 - Stdev([number1, ..., numberN]?) -> Number
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([23,56,89,12,45,78])
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
Stdev(23,56,89,12,45,78)
Sum
This function has 2 signatures:
- Since v1.0 - Sum(numbers) -> Number
- Since v1.0 - Sum([number1, ..., numberN]?) -> Number
Sum(numbers) -> Number
Function bundle: Core
Returns the sum of an array of numbers.
Parameter
Return value: Number
Example
prints 303
Sum([23,56,89,12,45,78])
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
Sum(23,56,89,12,45,78)
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
Tan(0.521)
Variance
This function has 2 signatures:
- Since v1.0 - Variance(numbers) -> Number
- Since v1.0 - Variance([number1, ..., numberN]?) -> Number
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([12,23,45,56,78,89])
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
Variance(12,23,45,56,78,89)