A newer version of this documentation is available.

View Latest

Number Functions

  • reference
    +

    Number functions are functions that are performed on a numeric field.

    ABS(expression)

    Description

    Returns absolute value of the number.

    ACOS(expression)

    Description

    Returns arc cosine in radians.

    ASIN(expression)

    Description

    Returns arc sine in radians.

    ATAN(expression)

    Description

    Returns arc tangent in radians.

    ATAN2(expression1, expression2)

    Description

    Returns arc tangent of expression2/expression1.

    CEIL(expression)

    Description

    Returns smallest integer not less than the number.

    COS(expression)

    Description

    Returns cosine.

    DEGREES(expression)

    Description

    Returns radians to degrees.

    E()

    Description

    Base of natural logarithms.

    EXP(expression)

    Description

    Returns eexpression.

    LN(expression)

    Description

    Returns log base e.

    LOG(expression)

    Description

    Returns log base 10.

    FLOOR(expression)

    Description

    Largest integer that is not greater than the number.

    PI()

    Returns PI.

    POWER(expression1, expression2)

    Description

    Returns expression1expression2.

    RADIANS(expression)

    Description

    Returns degrees to radians.

    RANDOM([ expression ])

    Description

    Returns pseudo-random number with optional seed.

    ROUND(expression [, digits ])

    Description

    Rounds the value to the given number of integer digits to the right of the decimal point (left if digits is negative). Digits is zero if not given.

    SIGN(expression)

    Description

    Valid values: -1, 0, or 1 for negative, zero, or positive numbers respectively.

    SIN(expression)

    Description

    Returns sine.

    SQRT(expression)

    Description

    Returns square root.

    TAN(expression)

    Description

    Returns tangent.

    TRUNC(expression [, digits ])

    Description

    Truncates the number to the given number of integer digits to the right of the decimal point (left if digits is negative). Digits is zero if not given.

    Example

    Query
    SELECT
        AVG(reviews.rating) / 5 AS normalizedRating,
        ROUND((avg(reviews.rating) / 5), 2) AS roundedRating,
        TRUNC((avg(reviews.rating) / 5), 3) AS truncRating
        FROM reviews AS reviews
        WHERE reviews.customerId = "customer62"

    Returns

    Result
    {
       "results": [
         {
           "normalizedRating": 0.42000000000000004,
           "roundedRating": 0.42,
           "truncRating": 0.42
         }
       ]
     }