# Math Functions

Version:
Current

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

### ABS

`ABS(x)`: Returns the 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

`ACOS(x)`: Returns the arccosine, or inverse 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

`ASIN(x)`: Returns the arcsine, or inverse 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

`ATAN(x)`: Returns the arctangent, or inverse 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

`ATAN2(y, x)`: Returns the arctangent of y and x (Arc - Tangent of (y/x)).

#### Example

`ATAN2(4, -3)` returns 2.2143.

### Average

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

#### Example

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

### CEIL

`CEIL(x)`: Returns the 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

`COS(x)`: Returns the cosine of (x).

### COSH

`COSH(x)` : Returns the hyperbolic cosine of (x).

### DISTANCE

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

#### Example

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

### EXP

`EXP(x)`: Returns e raised to the x power (e^x).

### FLOOR

`FLOOR(x)`: Returns the 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

`LOG(x)`: Returns the natural logarithm of (x).

#### Example

`LOG(1)` returns 0.

`LOG(14)` returns 2.639057.

### LOG10

`LOG10(x)`: Returns the base-10 logarithm of (x).

#### Example

`LOG10(1)` returns 0.

`LOG10(14)` returns 1.146128.

### Median

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

#### Example

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

### Mod

`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

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

#### Example

`PI()` returns 3.141593.

### POW

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

#### Example

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

### RAND

`RAND()`: Returns a random number greater than or equal to 0 and less than 1.

#### Example

`RAND()` returns a random number like 0.256.

### RandInt

`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, like 741.

### Round

`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

`SIN(x)`: Returns the sine of (x).

### SINH

`SINH(x)`: Returns the hyperbolic Sine of (x).

### SmartRound

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

### SQRT

`SQRT(x)`: Returns the square root of (x).

#### Example

`SQRT(100)` returns a value of 10.

### TAN

`TAN(x)`: Returns the tangent of (x).

### TANH

`TANH(x)`: Returns the hyperbolic tangent of (x).

Running into problems or issues with your Alteryx product? Visit the Alteryx Community or contact support.