Mathematical Functions

The mathematical functions described in this section perform mathematical operations.

Function Example Description

Abs

Abs(Profit)

Calculates the absolute value of a numeric expression.

Acos

Acos(1)

Calculates the arc cosine of a numeric expression.

Asin

Asin(1)

Calculates the arc sine of a numeric expression.

Atan

Atan(1)

Calculates the arc tangent of a numeric expression.

Atan2

Atan2(1, 2)

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

Ceiling

Ceiling(Profit)

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

Cos

Cos(1)

Calculates the cosine of a numeric expression.

Cot

Cot(1)

Calculates the cotangent of a numeric expression.

Degrees

Degrees(1)

Converts an expression from radians to degrees.

Exp

Exp(4)

Sends the value to the power specified.

ExtractBit

Int ExtractBit(1, 5)

Retrieves a bit at a particular position in an integer. It returns an integer of either 0 or 1 corresponding to the position of the bit.

Floor

Floor(Profit)

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

Log

Log(1)

Calculates the natural logarithm of an expression.

Log10

Log10(1)

Calculates the base 10 logarithm of an expression.

Mod

Mod(10, 3)

Divides the first numeric expression by the second numeric expression and returns the remainder portion of the quotient.

Pi

Pi()

Returns the constant value of pi.

Power

Power(Profit, 2)

Takes the first numeric expression and raises it to the power specified in the second numeric expression.

Radians

Radians(30)

Converts an expression from degrees to radians.

Rand

Rand()

Returns a pseudo-random number between 0 and 1.

RandFromSeed

Rand(2)

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

Round

Round(2.166000, 2)

Rounds a numeric expression to n digits of precision.

Sign

Sign(Profit)

This function returns the following:

  • 1 if the numeric expression evaluates to a positive number

  • -1 if the numeric expression evaluates to a negative number

  • 0 if the numeric expression evaluates to zero

Sin

Sin(1)

Calculates the sine of a numeric expression.

Sqrt

Sqrt(7)

Calculates the square root of the numeric expression argument. The numeric expression must evaluate to a nonnegative number.

Tan

Tan(1)

Calculates the tangent of a numeric expression.

Truncate

Truncate(45.12345, 2)

Truncates a decimal number to return a specified number of places from the decimal point.