This page lists the mathematical functions that are available in the GSQL query language. They are divided into three categories:
General
Logarithmic
Trigonometric
abs( num )
Returns the absolute value of a number.
Number
ceil(num)
Rounds a number up to the smallest integer that's greater than or equal to the number.
INT
exp(num)
Returns the base-e exponential of a number.
FLOAT
float_to_int (num)
Converts a floating-point number to an integer by truncating the floating part.
INT
floor(num)
Rounds a number down to the biggest integer that is smaller than or equal to the number.
INT
fmod(numer, denom)
Returns the floating-point remainder of numer
divided by denom
FLOAT
ldexp(x, exp)
Returns x
multiplied by 2 raised to the power of exp
FLOAT
PI()
Returns the value of π.
DOUBLE
None.
pow(base, exp)
Returns the power of a number.
FLOAT
rand( [seed] )
Returns a completely random number >= 0 and <1. If seed
is specified, it returns a repeatable sequence of random numbers. If no seed is specified, it returns a completely random number.
DOUBLE
round ( num[, integer] )
Rounds a number to a specified place relative to the decimal point and returns the result.
A numeric type.
sign( num )
Returns the sign of a number. If the number is positive, return 1
; if the number is negative, return -1
; if the number is 0
, return 0
INT
square( num )
Returns the square of a number.
A numeric type.
sqrt(num)
Returns the square root of a number
FLOAT
trunc( num, [decimal_place] )
Returns a number truncated to a specified decimal place.
A numeric type.
log(num)
Returns the natural logarithm of a number (base e).
DOUBLE
log2( num )
Returns the base-2 logarithm of a number.
DOUBLE
log10(num)
Return the common logarithm of a number (base 10).
FLOAT
acos(num)
Returns the arc cosine of a number.
FLOAT
asin(num)
Returns the arc sine of a number.
FLOAT
atan(num)
Returns the arctangent of a number.
FLOAT
atan2(y, x)
Returns the arctangent of a fraction.
FLOAT
cos(num)
Returns the cosine of a number.
FLOAT
cosh(num)
Returns the hyperbolic cosine of a number.
FLOAT
cot( num )
Returns the cotangent of a number.
DOUBLE
degrees( num )
Converts a value in radians to degrees.
DOUBLE
radians( num )
Converts a value in degrees to radians.
DOUBLE
sin(num)
Returns the sine of a number.
FLOAT
sinh(num)
Returns the hyperbolic sine of a number.
FLOAT
tan(num)
Returns the tangent of a number.
FLOAT
tanh(num)
Returns the hyperbolic tangent of a number.
FLOAT
Parameter
Description
Data type
num
The number to return the absolute value for
Number
Parameter
Description
Data type
num
The number to round up from
num
Parameter
Description
Data type
num
The exponent
Number
Parameter
Description
Data type
num
The floating-point number to convert to integer
FLOAT
Parameter
Description
Data type
num
The number to round down from
Number
Parameter
Description
Data type
numer
The dividend
Number
denom
The divisor
Number
Parameter
Description
Data type
x
The base
Number
exp
The exponent of 2
Number
Parameter
Description
Data type
base
The base
Number
exp
The exponent
Number
Parameter
Description
Data type
seed
Optional. If seed
is specified, it returns a repeatable sequence of random numbers. If no seed is specified, it returns a completely random number
UINT
Parameter
Description
Data type
num
The number to be rounded
NUM
integer
Optional. An integer value indicating the place to round the first argument to.
If integer
is positive, the function returns num
rounded to integer
places to the right of the decimal point. If you omit integer
, then num
is rounded to zero places. If integer
is negative, then num
is rounded off to the left of the decimal point.
INT
Parameter
Description
Data type
num
A numeric value
INT
, DOUBLE
Parameter
Description
Data type
num
A numeric value.
INT
, FLOAT
, or DOUBLE
Parameter
Description
Data type
num
The number to get square root for.
Number
Parameter
Description
Data type
num
The number to be truncated
INT
, FLOAT
or DOUBLE
decimal_place
Optional. The integer indicating the decimal place to truncate the number to.
If decimal_plac
is positive, the function returns the number truncated to decimal_place
decimal places. If decimal_place
is omitted, then the number is truncated to 0 places. decimal_place
can be negative to truncate (make zero) decimal_place
digits left of the decimal point.
INT
Parameter
Description
Data type
num
The number to compute natural logarithm for
Number
Parameter
Description
Data type
num
A numeric value
INT
, FLOAT
, DOUBLE
Parameter
Description
Data type
num
The number to compute common logarithm for
Number
Parameter
Description
Data type
num
The number to compute arccosine for
Number
Parameter
Description
Data type
num
The number to compute arcsine for
Number
Parameter
Description
Data type
num
The number to compute arctangent for
Number
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
Parameter
Description
Data type
num
The number to return cosine for
Number
Parameter
Description
Data type
num
The number to compute hyperbolic cosine for
Number
Parameter
Description
Data type
num
A numeric value
INT
, FLOAT
, or DOUBLE
Parameter
Description
Data type
num
A numeric value
INT
, FLOAT
, or DOUBLE
Parameter
Description
Data type
num
A numeric value
INT
, FLOAT
, or DOUBLE
Parameter
Description
Data type
num
The number to compute sine for
Number
Parameter
Description
Data type
num
The number to compute hyperbolic sine for
Number
Parameter
Description
Data type
num
The number to compute tangent for
Number
Parameter
Description
Data type
num
The number to compute hyperbolic tangent for
Number