# Mathematical Functions

SQL Function 1010data Function Description
AVG() g_avg(G;S;X) For SQL, the function returns the average value. For 1010data, the average of the values within a given group is returned.
ABS() abs(x) Returns the absolute value of a given value.
ACOS() acos(X) Returns the arccosine (in radians) of the given value.
ASIN() asin(X) Returns the arcsine (in radians) of the given value.
ATAN() atan(X) Returns the arctangent (in radians) of the given value.
BIT_AND() bitand(X;Y) Returns the bitwise AND of two 32-bit integers.
BIT_OR() bitor(X;Y) Returns the bitwise OR of two 32-bit integers.
BIT_XOR() bitxor(X;Y) Returns the bitwise XOR (exclusive-OR) of two 32-bit integers.
CAST(expr AS type) int(X) Returns the largest integer less than or equal to the given value, expressed as an integer number.
real(X) Returns the given value expressed as a decimal number.
CEIL() ceil(X) Returns the smallest integer greater than or equal to the given value, expressed as a decimal number.
COS() cos(X) Returns the cosine of the given value.Returns the cosine of the given value.
COUNT() g_cnt(G;S) For SQL, the function returns the number of rows. For 1010data the number of rows within a given group is returned.
COUNT(DISTINCT expr) g_ucnt(G;S;X) Returns the number of distinct values within a given group.
FIRST() g_first(G;S;O;X) For SQL, the function returns the first value in the designated column. For 1010data the first non-N/A value within a given group is returned.
g_first1(G;S;O) For SQL, the function returns the first value in the designated column. For 1010data, a boolean value indicating whether this is the first row in a given group is returned.
LAST() g_last(G;S;O;X) For SQL, the function returns the last value in the designated column. For 1010data, the last non-N/A value within a given group is returned.
g_last1(G;S;O) For SQL, the function returns the last value in the designated column. For 1010data, a boolean value indicating whether this is the last row in a given group is returned.
LOG() loge(X) Returns the natural logarithm of the given value.
LOG10() log(X;Y) For SQL, the base-10 logarithm is returned. For 1010data, the logarithm of the first given value to the base of the second given value is returned.
LOG2() For SQL, the base-2 logarithm is returned. For 1010data, the logarithm of the first given value to the base of the second given value is returned.
MAX() max(X;Y) For SQL, the function returns the largest value in the designated column. For 1010data, the larger of two given values is returned.
g_hi(G;S;X) For SQL, the function returns the largest value in the designated column. For 1010data, the highest value within a given group is returned.
MIN() min(X;Y) For SQL, the function returns the smallest value in the designated column. For 1010data, the smaller of two given values is returned.
g_lo(G;S;X) For SQL, the function returns the smallest value in the designated column. For 1010data, the lowest value within a given group is returned.
MOD() mod(X;Y) Returns the modulo of two given values.
RAND() draw(X;Y) For SQL, returns a random floating point value. For 1010data, using X as a seed, random numbers are drawn between 0 and Y-1. ( _ should be used when selects and links with expansions are sued)
draw_(X;Y)
STD() g_std(G;S;X) For SQL, the function returns the standard deviation of the population. For 1010data, the population standard deviation of values within a given group is returned.
r_std(C;S) For SQL, the function returns the standard deviation of the population. For 1010data, the standard deviation of values across a given set of columns is returned.
SUM() g_sum(G;S;X) For SQL, the function returns the sum of the values within a column. For 1010data, the sum of values within a given group is returned.
VARIANCE() g_var(G;S;X) For SQL, the function returns the variance a population. For 1010data, the variance of values within a given group is returned.