# Math Functions

Version:
2019.3

A math function performs mathematical calculations. Math functions can only be used with Number data types.

`ABS(x)`: Absolute value of (x). It is the distance between 0 and a number. The value is always positive.

#### Example

`ABS(32)` returns 32

`ABS(-32)` returns 32

`ACOS(x)`: Arc - Cosine of (x)

Returns the arccosine, or inverse cosine, of a number. The arccosine is the angle whose cosine is (x). The returned angle is given in radians in the range 0 (zero) to pi. The number (x) must be between -1 and 1.

#### Example

`ACOS(0.5)` returns 1.047198

`ASIN(x)`: Arc - Sine of (x)

Returns the arcsine, or inverse sine, of a number. The arcsine is the angle whose sine is (x). The returned angle is given in radians in the range -pi/2 to pi/2.

#### Example

`ASIN(0.5)` returns 0.523599

`ATAN(x)`: Arc - Tangent of (x)

Returns the arctangent, or inverse tangent, of a number. The arctangent is the angle whose tangent is (x). The returned angle is given in radians in the range -pi/2 to pi/2.

#### Example

`ATAN(0.8)` returns 0.674741

`ATAN2(y, x)`: Arc - Tangent of (y/x)

Returns the arctangent of y and x.

#### Example

`ATAN2(4, -3)` returns 2.2143

`Average(n1,...)`: Average of a list of numbers.

#### Example

`Average(20,30,55)` returns 35 since [(20+30+55)/3]= 35

`CEIL(x)`: Returns smallest integer greater than or equal to (x). Works like the RoundUp function in Excel.

#### Example

`CEIL(1.1)` returns 2

`CEIL (6.54)` returns 7

`CEIL(-30.42)` returns -30

`COS(x)`: Cosine of (x)

`COSH(x)` : Hyperbolic Cosine of (x)

`DISTANCE(from_Lat,from_Lon, to_Lat, to_Lon)`: Returns distance from (lat1,Lon1) to (lat2,lon2)

#### Example

`DISTANCE(42,-90, 43, -80)` returns a value of 513.473706 miles

`EXP(x)`: Returns e^x

`FLOOR(x)`: Returns largest integer less than or equal to (x)

#### Example

`FLOOR(1.1)` returns 1

`FLOOR(6.54)` returns 6

`FLOOR(-30.42)` returns -31

`LOG(x)`: Natural logarithm of `(x)`

#### Example

`LOG(1)` returns 0

`LOG(14)` returns 2.639057

`LOG10(x)`: Base 10 logarithm of `(x)`

#### Example

`LOG10(1)` returns 0

`LOG10(14)` returns 1.146128

`Median(...)`: Calculates the median out of one or more (possibly unsorted) values.

#### Example

`Median (5, 4, 3, 7, 6)` returns 5

`Mod(n,d)`: Modulo of n divided by d (integer operation)

The Modulo operation finds the remainder of one integer (n) divided by a divisor integer (d). If (n) is positive, the result is positive. If (n) is negative, the result is negative.

If decimal values are used, the decimal is truncated. This can result in a "Divided by 0" error if the divisor is a decimal less than 1.

#### Example

`MOD(6,4)` returns 2

`MOD(6,-4)` returns 2

`MOD(-6,4)` returns -2

`MOD(-6,-4)` returns -2

`MOD(6,.4)` returns [Null]

`PI()`: Returns the value of the constant PI to 15 digits of accuracy

#### Example

`PI()` returns  3.141593

`POW(x, e)`: Returns (x) raised to the (e) power

#### Example

`POW(2, 3)` is equivalent to 2 3 and returns 8

`RAND()`: Returns a random number between 0 and 1

#### Example

`RAND()` returns a random number like 0.256

`RandInt(n)`: Returns a random integer between 0 and the specified parameter

#### Example

`RandInt(10)` returns 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 or 10

`RandInt(5000)` returns a random whole number between 0 and 5000, such as 741

`Round(x, mult)`: Returns (x) rounded to nearest multiple of (mult)

#### Example

`Round(55.34, 2)` returns a value of 56

`Round(39.88, 10)` returns a value of 40

`Round(41.1, 10)` returns a value of 40

`Round(1.25, 0.1)` returns a value of 1.3

`Round(1.227, 0.01)` returns a value of 1.23

`SIN(x)`: Sine of `(x)`

`SINH(x)`: Hyperbolic Sine of `(x)`

`SmartRound(x)`: Returns (x) rounded to nearest multiple of a value determined dynamically based on the size of `(x)`

`SQRT(x)`: Square root of `(x)`

#### Example

`SQRT(100)` returns a value of 10

`TAN(x)`: Tangent of `(x)`

`TANH(x)`: Hyperbolic Tangent of `(x)`

Need something else? Visit the Alteryx Community or contact support.