4. Elements of OpenSQL Statements : Functions : Scalar Functions : Numeric Functions
 
Share this page                  
Numeric Functions
OpenSQL supports the numeric functions listed in the following table:
Name
Operand Type
Result Type
Description
abs(n)
all numeric types and money
same as n
Absolute value of n.
atan(n)
all numeric types
float
Arctangent of n; returns a value from (-pi/2) to pi/2.
cos(n)
all numeric types
float
Cosine of n; returns a value from -1 to 1.
exp(n)
all numeric types and money
float
Exponential of n.
log(n)
ln(n)
all numeric types and money
float
Natural logarithm of n.
mod(n,b)
integer,
smallint,
integer1, decimal
same as b
n modulo b. The result is the same data type as b.
Decimal values are truncated.
power(x,y)
all numeric types
float
x to the power of y (identical to x ** y)
sin(n)
all numeric types
float
Sine of n; returns a value from -1 to 1.
sqrt(n)
all numeric types and money
float
Square root of n.
For trigonometric functions (atan(), cos(), and sin()), specify arguments in radians. To convert degrees to radians, use the following formula:
radians = degrees/360 * 2 * pi
To obtain a tangent, divide sin() by cos().