Math Functions

The math functions perform mathematical operations.

Functions

ABS

This function calculates the absolute value of a numeric expression.

Syntax

ABS(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

ACOS

This function calculates the arc cosine of a numeric expression.

Syntax

ACOS(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

ASIN

This function calculates the arc sine of a numeric expression.

Syntax

ASIN(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

ATAN

This function calculates the arc tangent of a numeric expression.

Syntax

Atan(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

ATAN2

This function calculates the arc tangent of y/x, where y is the first numeric expression
and x is the second numeric expression.

Syntax

Atan2(numExpr1, numExpr2)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

CEILING

This function rounds a noninteger numeric expression to the next highest integer. If
the numeric expression evaluates to an integer, the CEILING function returns that
integer.

Syntax

CEILING(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

COS

This function calculates the cosine of a numeric expression.

Syntax

COS(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

COT

This function calculates the cotangent of a numeric expression.

Syntax

COT(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

DEGREES

This function converts an expression from radians to degrees.

Syntax

DEGREES(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

EXP

This function sends the value to the power specified.

Syntax

EXP(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

FLOOR

This function rounds a noninteger numeric expression to the next lowest integer. If
the numeric expression evaluates to an integer, the FLOOR function returns that
integer.

Syntax

FLOOR(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

LOG

This function calculates the natural logarithm of an expression.

Syntax

LOG(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

LOG10

This function calculates the base 10 logarithm of an expression.

Syntax

LOG10(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

MOD

This function divides the first numeric expression by the second numeric expression
and returns the remainder portion of the quotient.

Syntax

MOD(numExpr1, numExpr2)

Where

numExpr is any expression that evaluates to a numeric value.

Examples

This example request returns a value of 0:

MOD(9, 3)

This example request returns a value of 1:

MOD(10, 3)

 

 

PI

This function returns the constant value of pi (the circumference of a circle divided
by its diameter).

Syntax

PI()

 

 

POWER

This function takes the first numeric expression and raises it to the power specified
in the second numeric expression.

Syntax

POWER(numExpr1, numExpr2)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

RADIANS

This function converts an expression from degrees to radians.

Syntax

RADIANS(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

RAND

This function returns a pseudo-random number between 0 and 1.
note: The Analytics Server does not cache queries that contain this function.

Syntax

RAND()

 

 

RANDFROMSEED

This function returns a pseudo-random number based on a seed value. For a given
seed value, the same set of random numbers are generated.

Syntax

RANDFROMSEED(numExpr)

Where

numExpr is any expression that evaluates to a numeric value.

 

 

ROUND

This function rounds a numeric expression to n digits of precision.

Syntax

ROUND(numExpr, integer)

Where

numExpr is any expression that evaluates to a numeric value.
integer is any positive integer that represents the number of digits of precision.

 

 

TRUNCATE

This function truncates a decimal number to return a specified number of places
from the decimal point.

Syntax

TRUNCATE(numExpr, integer)

Where

numExpr is any expression that evaluates to a numeric value.
integer is any positive integer that represents the number of characters to the
right of the decimal place to return.

Examples

This example returns 45.12:

TRUNCATE(45.12345, 2)

This example returns 25.12:

TRUNCATE(25.126, 2)