skip to main content
SQL Escape Sequences : Scalar Functions : Numeric Functions
 

Numeric Functions

The following table lists numeric functions. The following arguments can be used with numeric functions:
numeric_exp can be a column name, a numeric literal, or the result of another scalar function, where the underlying data type is SQL_NUMERIC, SQL_DECIMAL, SQL_TINYINT, SQL_SMALLINT, SQL_INTEGER, SQL_BIGINT, SQL_FLOAT, SQL_REAL, or SQL_DOUBLE.
float_exp can be a column name, a numeric literal, or the result of another scalar function, where the underlying data type is SQL_FLOAT.
integer_exp can be a column name, a numeric literal, or the result of another scalar function, where the underlying data type is SQL_TINYINT, SQL_SMALLINT, SQL_INTEGER, or SQL_BIGINT.
 
Table 37: Numeric Functions
Function
Returns
ABS(numeric_exp)
Absolute value of numeric_exp.
ACOS(float_exp)
Arccosine of float_exp as an angle in radians.
ASIN(float_exp)
Arcsine of float_exp as an angle in radians.
ATAN(float_exp)
Arctangent of float_exp as an angle in radians.
ATAN2(float_exp1, float_exp2)
Arctangent of the x and y coordinates, specified by float_exp1 and float_exp2 as an angle in radians.
CEILING(numeric_exp)
Smallest integer greater than or equal to numeric_exp.
COS(float_exp)
Cosine of float_exp as an angle in radians.
COT(float_exp)
Cotangent of float_exp as an angle in radians.
DEGREES(numeric_exp)
Number if degrees converted from numeric_exp radians.
EXP(float_exp)
Exponential value of float_exp.
FLOOR(numeric_exp)
Largest integer less than or equal to numeric_exp.
LOG(float_exp)
Natural log of float_exp.
LOG10(float_exp)
Base 10 log of float_exp.
MOD(integer_exp1, integer_exp2)
Remainder of integer_exp1 divided by integer_exp2.
PI()
Constant value of pi as a floating-point number.
POWER(numeric_exp, integer_exp)
Value of numeric_exp to the power of integer_exp.
RADIANS(numeric_exp)
Number of radians converted from numeric_exp degrees.
RAND([integer_exp])
Random floating-point value using integer_exp as the optional seed value.
ROUND(numeric_exp, integer_exp)
numeric_exp rounded to integer_exp places right of the decimal (left of the decimal if integer_exp is negative).
SIGN(numeric_exp)
Indicator of the sign of numeric_exp.
If numeric_exp < 0, -1 is returned.
If numeric_exp = 0, 0 is returned.
If numeric_exp > 0, 1 is returned.
SIN(float_exp)
Sine of float_exp, where float_exp is an angle in radians.
SQRT(float_exp)
Square root of float_exp.
TAN(float_exp)
Tangent of float_exp, where float_exp is an angle in radians.
TRUNCATE(numeric_exp, integer_exp)
numeric_exp truncated to integer_exp places right of the decimal. (If integer_exp is negative, truncation is to the left of the decimal.)