Math Functions

SQL for CRM Analytics supports the following math functions.

  • abs(n)

    Returns the absolute number of n as a numeric value. n can be any real numeric value in the range of -1.797e308 <= n <= 1.797e308.

  • acos(n)

    Returns the arccosine value of radians value {n}. {n} can be any real number in the range of -1 <= {n} <= 1. If null is passed as an argument, acos() returns null.

  • asin(n)

    Returns the arcsine value of radians value {n}. {n} can be any real number in the range of -1 <= {n} <= 1. If null is passed as an argument, sin() returns null.

  • atan(n)

    Returns the arctan value of radians value {n}. {n} can be any real number in the range of -1e308 <= {n} <= 1e308. If null is passed as an argument, atan() returns null.

  • ceil(n), ceiling(n)

    Returns the nearest integer of equal or greater value to n. n can be any real numeric value in the range of -1.797e308 <= n <= 1.797e308.

  • cos(n)

    Returns the cosine value of radians value {n}. {n} can be any real number in the range of -1e308 <= {n} <= 1e308. If null is passed as an argument, cos() returns null.

  • degrees(n)

    Returns the degrees value of {n} radians. {n} can be any real number in the range of -1e308 <= {n} <= 1e308. If null is passed as an argument, radians() returns null.

  • exp(n)

    Returns the value of Euler’s number e raised to the power of n, where e = 2.71828183… The smallest value for n that does not result in 0 is 3e-324. n can be any real numeric value in the range of -1.797e308 <= n <= 700.

  • floor(n)

    Returns the nearest integer of equal or lesser value to n. n can be any real numeric value in the range of -1.797e308<= n <= 1.797e308.

  • ln(n)

    Returns the base e (Euler’s number) logarithm of a number n. The value n can be any positive, non-zero numeric value in the range 0 < n <= 1.797e308.

  • log(m,n)

    Returns the natural logarithm (base m) of a number n. The values m and n can be any positive, non-zero numeric value in the range 0 < m, n <= 1.797e308 and m ≠ 1.

  • log10(n)

    Returns the base 10 logarithm of a number n. The value n can be any positive, non-zero numeric value in the range 0 < n <= 1.797e308.

  • pi()

    Returns the value of constant π, where π=3.14159.

  • power(m,n)

    Returns m raised to the _n_th power. m, n can be any numeric value in the range of -1.797e308 <= m, n <= 1.797e308. Returns null if m = 0 and n < 0.

  • radians(n)

    Returns the radians value of {n} degrees. {n} can be any real number in the range of -1e308 <= {n} <= 1e308. If null is passed as an argument, radians() returns null.

  • round(n[,m])

    Returns the value of n rounded to m decimal places. m can be negative, in which case the function returns n rounded to -m places to the left of the decimal point. If m is omitted, it returns n rounded to the nearest integer. For tie-breaking, it follows round half way from zero convention. n can be any real numeric value in the range of -1.797e308 <= n <= 1.797e308. m can be an integer value between -15 and 15, inclusive.

  • sign(n)

    Returns 1 if the numeric value, {n} is positive. It returns -1 if the {n} is negative, and 0 if {n} is 0. {n} can be any real number in the range of -1e308 <= {n} <= 1e308.

  • sin(n)

    Returns the sine value of radians value {n}. {n}can be any real number in the range of -1e308 <= {n} <= 1e308. If null is passed as an argument, sin() returns null.

  • sqrt(n)

    Returns the square root of a number n. The value n can be any non-negative numeric value in the range of 0 <= n <= 1.797e308.

  • tan(n)

    Returns the tan value of radians value {n}. {n} can be any real number in the range of -1e308 <= {n} <= 1e308. If null is passed as an argument, tan() returns null.

  • trunc(n[,m])

    Returns the value of the numeric expression n truncated to m decimal places. m can be negative, in which case the function returns n truncated to -m places to the left of the decimal point. If m is omitted, it returns n truncated to the integer place. n can be any real numeric value in the range of -1.797e308 <= n <= 1.797e308. m can be an integer value between -15 and 15 inclusive.