Mathematical Functions

This page lists the mathematical functions that are available in the GSQL query language. They are divided into three categories:

  • General

  • Logarithmic

  • Trigonometric

General

abs()

Syntax

abs( num )

Description

Returns the absolute value of a number.

Return type

Number

Parameters

Parameter

Description

Data type

num

The number to return the absolute value for

Number

ceil()

Syntax

ceil(num)

Description

Rounds a number up to the smallest integer that's greater than or equal to the number.

Return type

INT

Parameters

Parameter

Description

Data type

num

The number to round up from

num

exp()

Syntax

exp(num)

Description

Returns the base-e exponential of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The exponent

Number

float_to_int()

Syntax

float_to_int (num)

Description

Converts a floating-point number to an integer by truncating the floating part.

Return type

INT

Parameters

Parameter

Description

Data type

num

The floating-point number to convert to integer

FLOAT

floor()

Syntax

floor(num)

Description

Rounds a number down to the biggest integer that is smaller than or equal to the number.

Return type

INT

Parameter

Parameter

Description

Data type

num

The number to round down from

Number

fmod()

Syntax

fmod(numer, denom)

Description

Returns the floating-point remainder of numer divided by denom

Return type

FLOAT

Parameters

Parameter

Description

Data type

numer

The dividend

Number

denom

The divisor

Number

ldexp()

Syntax

ldexp(x, exp)

Description

Returns x multiplied by 2 raised to the power of exp

x2expx*2^{exp}

Return type

FLOAT

Parameters

Parameter

Description

Data type

x

The base

Number

exp

The exponent of 2

Number

pow()

Syntax

pow(base, exp)

Description

Returns the power of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

base

The base

Number

exp

The exponent

Number

sqrt()

Syntax

sqrt(num)

Description

Returns the square root of a number

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to get square root for.

Number

Logarithmic

log()

Syntax

log(num)

Description

Returns the natural logarithm of a number (base e).

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute natural logarithm for

Number

log10()

Syntax

log10(num)

Description

Return the common logarithm of a number (base 10).

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute common logarithm for

Number

Trigonometric

acos()

Syntax

acos(num)

Description

Returns the arc cosine of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute arccosine for

Number

asin()

Syntax

asin(num)

Description

Returns the arc sine of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute arcsine for

Number

atan()

Syntax

atan(num)

Description

Returns the arctangent of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute arctangent for

Number

atan2()

Syntax

atan2(y, x)

Description

Returns the arctangent of a fraction.

atan(yx)atan(\frac{y}x)

Return type

FLOAT

Parameters

Parameter

Description

Data type

y

The dividend of the fraction to compute arctangent for

Number

x

The divisor of the fraction to compute arctangent for

Number

cos()

Syntax

cos(num)

Description

Returns the cosine of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to return cosine for

Number

cosh()

Syntax

cosh(num)

Description

Returns the hyperbolic cosine of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute hyperbolic cosine for

Number

sin()

Syntax

sin(num)

Description

Returns the sine of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute sine for

Number

sinh()

Syntax

sinh(num)

Description

Returns the hyperbolic sine of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute hyperbolic sine for

Number

tan()

Syntax

tan(num)

Description

Returns the tangent of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute tangent for

Number

tanh()

Syntax

tanh(num)

Description

Returns the hyperbolic tangent of a number.

Return type

FLOAT

Parameters

Parameter

Description

Data type

num

The number to compute hyperbolic tangent for

Number

Last updated