# Math Functions

Studio offers a wide range of mathematical functions that can be utilized in expressions.

Function | Description |
---|---|

abs(`real` ) | Returns the absolute value of a number. |

acos(`real` ) | Returns the arccosine of an angle. |

acosh(`real` ) | Returns the hyperbolic arccosine of an angle. |

asin(`real` ) | Returns the arcsine of an angle. |

asinh(`real` ) | Returns the hyperbolic arcsine of an angle. |

atan(`real` ) | Returns the arctangent of an angle. |

atan2(`real` ,`real` ) | Returns the two-variable arctangent of an angle. |

atanh(`real` ) | Returns the hyperbolic arctangent of an angle. |

cbrt(`real` ) | Returns the cube root of an item. |

ceil(`real` ) | Rounds the floating number up to the nearest integer. |

cos(`real` ) | Returns the cosine of an angle. |

cosh(`real` ) | Returns the hyperbolic cosine of an angle. |

exp(`real` ) | Raises `e` to the power of a number (inverse of natural logarithm). |

expm1(`real` ) | Returns `e^x - 1` , where x is the provided argument. |

floor(`real` ) | Rounds the floating number down to the nearest integer. |

fround(`real` ) | Returns the nearest 32-bit single precision float representation of the provided argument. |

hypot(`real` , `real` ) | Returns the square root of the sum of squares from the provided arguments. |

imul(`int` ,`int` ) | Returns the result of the C-like 32-bit multiplication of the two provided arguments. |

log(`real` ) | Returns the natural logarithm of a number. |

log10(`real` ) | Returns the common logarithm of a number. |

log1p(`real` ) | Returns the natural logarithm of 1 + x, where x is the provided argument. |

log2(`real` ) | Returns the binary logarithm of a number. |

max(`real` , `real` ) | Returns the maximum value from the provided arguments. |

min(`real` , `real` ) | Returns the minimum value from the provided arguments. |

pow(`base` ,`exponent` ) | Raises a `base` to the power of an `exponent` . |

round(`real` ) | Rounds the floating number to the nearest integer. |

sign(`real` ) | Extracts the sign from a real number. |

sin(`real` ) | Returns the sine of an angle. |

sinh(`real` ) | Returns the hyperbolic sine of an angle. |

sqrt(`real` ) | Returns the square root of a number. |

tan(`real` ) | Returns the tangent of an angle. |

tanh(`real` ) | Returns the hyperbolic tangent of an angle. |

trunc(`float` ) | Returns the integer part of a number by removing any fractional digits. |

# API Reference

### abs

Returns the absolute value of a number. All numbers greater or equal to zero are returned unchanged, while any number less than zero is negated.

#### Example

Suppose `col`

is a column containing positive or negative numbers.

```
abs(col);
```

### acos

Returns the arccosine (in radians) of a number. The value returned is a numerical value between 0 and ฯ radians for x between -1 and 1. If the value provided is outside of this range, no value is returned.

#### Example

Suppose `col`

is a column representing consine values, where each value is between -1 and 1.

```
abs(col);
```

### acosh

Returns the hyperbolic arc-cosine of a number. If the number provided is less than 1, no value is returned.

#### Example

Suppose `col`

is a column containing values greater than 1.

```
acosh(col);
```

### asin

Returns the arcsine of a number, represented as a numerical value between -ฯ/2 and ฯ/2 radians. If the number provided is greater than 1 or less than -1, no value is returned.

#### Example

Suppose `col`

is a column containing values between 1 and -1.

```
asin(col);
```

### asinh

Returns the hyperbolic arcsine of a number.

#### Example

Suppose `col`

is a column containing numerical values.

```
asihn(col);
```

### atan

Returns arctangent of a number, represented as a numerical value between -ฯ/2 and ฯ/2 radians.

#### Example

Suppose `col`

is a column containing numerical values.

```
atan(col);
```

### atan2

Returns the angle in the plane between the positive x-axis and the ray from (0,0) to the point (x,y). The angle is represented in radians (in the range of -ฯ , ฯ) between the positive x-axis and the ray from (0,0) to the point (x,y).

#### Example

Suppose `y`

is the y coordinate of a point, and `x`

is the x coordinate of a point.

```
atan2(y, x);
```

### atanh

Returns the hyperbolic arctangent of a number. If the number provided is greater than 1 or less than -1, no value is returned.

#### Example

Suppose `col`

is a column containing numerical values.

```
atan(col);
```

### cbrt

Returns the cube root of the number.

#### Example

Assume `col`

is a column containing numerical values.

```
cbrt(col);
```

### ceil

Returns the provided value rounded to the next largest integer.

#### Example

Assume `col`

is a column containing numerical values.

```
ceil(col);
```

### cos

Returns the cosine of the angle, which must be specified in radians. The angle returned is a number between -1 and 1, representing the cosine of the angle.

#### Example

Assume `col`

is a column containing numerical values.

```
cos(col);
```

### cosh

Returns the hyperbolic cosine of a number.

#### Example

Assume `col`

is a column containing numerical values.

```
cosh(col);
```

### exp

Returns `e^x`

, where `x`

is the argument, and `e`

Euler's number (the base of the natural logarithm).

As `e`

to the power of numbers close to 0 will be very close to 1, the result may lack precision. In these cases, use expm1.

#### Example

Assume `col`

is a column containing numerical values.

```
exp(col);
```

### expm1

Returns `e^x - 1`

, where `x`

is the argument, and `e`

Euler's number (the base of the natural logarithm).

#### Example

Assume `col`

is a column containing numerical values.

```
expm1(col);
```

### floor

Returns the value rounded down to nearest integer.

#### Example

Assume `col`

is a column containing numerical values.

```
floor(col);
```

### fround

Returns the nearest 32-bit single precision float representation of a number. This function can be used to cast a 64-bit float to a 32-bit float. The value will continue to be treated as a 64-bit float with the 23rd bit of the mantissa rounded, followed by `0`

mantissa bits.

#### Example

Assume `col`

is a column containing numerical values.

```
fround(col);
```

### hypot

Returns the square root of the sum of squares from the provided arguments. To compute the hypotenuse of a triangle, include the length of the base and perpendicular sides of the triangle.

This function can also be used to compute the magnitude of a complex number with any number of arguments.

#### Example

Assume `v1`

and `v2`

are columns that represent two sides of a set of triangular geometries.

```
hypot(v1, v2);
```

### imul

Returns the 32-bit multiplication of the provided integers. If values are provided in `float`

rather than `int`

, they will be converted to an `int`

for multiplication, then converted back into a `float`

.

#### Example

Assume `int_1`

and `int_2`

are two integers.

```
imul(int_1, int_2);
```

### log

Returns the natural logarithm (base e) of a number. If the input value is less than or equal to zero, no value is returned. Positive numbers close to 1 can suffer from loss of precision. In cases where your input may contain numbers close to 1, use log1p.

#### Example

Assume `col`

is a column containing numerical values.

```
log(col);
```

### log10

Returns the common logarithm (base 10) of a number. If the input value is less than zero, no value is returned.

#### Example

Assume `col`

is a column containing numerical values.

```
log10(col);
```

### log1p

Returns the natural logarithm (base e) of a number plus one. If the input value is less than -1, no value is returned.

#### Example

Assume `col`

is a column containing numerical values.

```
log1p(col);
```

### log2

Returns the binary logarithm (base 2) of a number. If the number is less than 0, no value is returned.

#### Example

Assume `col`

is a column containing numerical values.

```
log2(col);
```

### max

Returns the largest of one or more numbers given as input parameters. If one or more values is not a number and cannot be converted into one, no value is returned.

#### Example

Assume `val1`

, `val2`

, and `val3`

are columns containing numerical values.

```
max(val1, val2, val3);
```

### min

Returns the smallest of one or more numbers given as input parameters. If one or more values is not a number and cannot be converted into one, no value is returned.

#### Example

Assume `val1`

, `val2`

, and `val3`

are columns containing numerical values.

```
min(val1, val2, val3);
```

### pow

Raise a `base`

number by an `exponent`

value.

#### Example

Assume `base`

is a column containing base values, and `exponent`

is a column containing exponent values.

```
pow(base, exponent);
```

### round

Rounds the given number to the nearest integer. If the fractional portion of the argument is greater than 0.5, the value is rounded to the integer with the next highest absolute value. Conversely, if the fractional portion is less than 0.5, the value is rounded to the integer with the lower absolute value. If the fractional portion is exactly 0.5, the argument is rounded in the direction of positive infinity.

#### Example

Assume `col`

is a column containing `float`

values.

```
round(col);
```

### sign

Returns the sign (not to be confused with the geometric sine) of the number. If the provided number is positive, the output will be `1`

, and if negative, the output will be `-1`

. If the input is 0, the output is `0`

.

#### Example

Assume `col`

is a column containing numerical values.

```
sign(col);
```

### sin

Returns the sine of a number, represented as an angle between -1 and 1 radians.

Assume `col`

is a column containing numerical values.

```
floor(col);
```

#### Example

Assume `col`

is a column containing numerical values.

```
sin(col);
```

### sinh

Returns the hyperbolic sine of a number.

#### Example

Assume `col`

is a column containing numerical values.

```
sinh(col);
```

### sqrt

Returns the square root of a number. If the number is negative, no value is returned.

#### Example

Assume `col`

is a column containing numerical values.

```
sqrt(col);
```

### tan

Returns the tangent of an angle expressed in radians.

#### Example

Assume `col`

is a column containing numerical values.

```
tan(col);
```

### tanh

Returns the hyperbolic tangent of a number.

#### Example

Assume `col`

is a column containing numerical values.

```
tanh(col);
```

### trunc

Returns the integer part of a number, removing any fractional digits. As opposed to ceil, floor, and round functions, this function does not consider the sign of the number.

#### Example

Assume `col`

is a column containing numerical values.

```
trunc(col);
```

Updated 4 months ago