# Number Functions

## Number Functions

TrackVia has built-in number functions. The table below describes how these functions can be used in a calculated field's formula and the inputs that the functions require. In your formulas, these would be:

• Field name inside curly brackets
• Text in quotes
• Numbers on their own or within quotes

Function Description
abs()

abs(number)
Absolute value of a number

abs(-1) returns 1
abs(1) returns 1
exp()

exp(x)
Exponential of x (e to the power of x)

exp(1) returns 2.718...
ln()

ln(x)
Natural logarithm of x (base e)
ln(2) returns 0.693...
log()

log(base_or_x, x)
Logarithm of x (specified base)
log(3, 2) returns 1.584...
log10()

log10(x)
Common logarithm of x (base 10)
log10(2) returns 0.301...
mod()

mod(number, modulus)
Returns the remainder after dividing number by modulus
mod(7, 2) returns 1
mod(6, 2) returns 0
power()

power(x, y)
Raise x to the power of y
power(2, 3) returns 8
rand()

rand()
Returns a random number between 0 and 1

Please note that when a Calculated or Triggered Number field references another field that uses rand(), the results may be unpredictable.
round()

round(x, y)
Rounds a number, x, to y number of decimal places
round(4/3, 3) returns 1.333
round(1.6772, 2) returns 1.68
sign()

sign(x)
Returns 0 if x is zero, -1 if x is negative, and 1 if x is positive
sign(5) returns 1
sign(0) returns 0
sign(-5) returns -1
sqrt()

sqrt(x)
Square root of x
sqrt(64) returns 8
sqrt(12) returns 3.464...
sin()

sin(x)
Sine of x
sin(2) returns 0.909...
cos()

cos(x)
Cosine of x

cos(2) returns -0.416...
tan()

tan(x)
Tangent of x

tan(2) returns -2.185...
asin()

asin(number)
Inverse Sine of a number
asin(1) returns 1.570...
acos()

acos(number)
Inverse Cosine of a number
acos(1) returns 0
atan()

atan(number)
Inverse Tangent of a number
atan(1) returns 0.785...
atan2()

atan2(x, y)
Arc tangent of the two variables x and y
atan2(1, 2) returns 0.463...
degrees()

Number of degrees in an angle of x radians
degrees(π/2) returns 90

Number of radians in an angle of x degrees
pi()

pi()
The constant pi, 3.14159... (takes no inputs)
ceiling()

ceiling(x)
Rounds up to the next integer.

ceiling(6.1) returns 7.
floor()

floor(x)
Rounds down to the closest integer.

floor(6.1) returns 6.
null()

null()
The null() function can be used on its own or in a logic formula. This function is commonly used in an if() function to return nothing in a field if a condition is not met.
coalesce()

coalesce()
The coalesce() function serves to substitute null values with another value for arithmetic expressions.

Coalesce({Field1}, 0) + Coalesce({Field2}, 0) will add Field1 and Field2 together even if one value is null.