Math Functions

Advantage SQL Engine

num = Expression or literal resulting in a numeric value.

float = Expression or literal resulting in a floating point value.

int = Expression or literal resulting in a integer value.

 

ABS( num )

Returns the absolute value of a numeric.

ACOS( float )

Returns the arccosine of float as an angle, expressed in radians.

ASIN( float )

Returns the arcsine of float as an angle, expressed in radians.

ATAN( float )

Returns the arctangent of float as an angle, expressed in radians.

ATAN2( float1, float2 )

Returns the arctangent of the x and y coordinates, specified by float1 and float2, as an angle, expressed in radians.

CEILING( num )

Returns the smallest integer greater than or equal to num. The return value is of the same data type as the input parameter.

COS( float )

Returns the cosine of float, where float is an angle expressed in radians.

COT( float )

Returns the cotangent of float, where float is an angle expressed in radians.

DEGREES( num )

Returns the number of degrees converted from radians.

EXP( float )

Returns the exponential value of float.

FLOOR( num )

Returns the largest integer less than or equal to num. The return value is of the same data type as the input parameter.

LOG( float )

Returns the natural logarithm of float.

LOG10( float )

Returns the base 10 logarithm of float.

MOD( int1, int2 )

Returns the modulus (remainder) of int1 divided by int2.

PI( )

Returns the value of pi as a floating point value constant.

POWER( num, int )

Returns the value of num raised to the power of int.

RADIANS( num )

Returns the number of radians converted from degrees.

RAND( [int] )

Returns a random floating point value between 0 and 1 using int as an optional seed value. If zero is specified as the seed value, the current time in milliseconds (seconds on NetWare) is used as the seed. Seeding RAND() is not required and RAND() should only be seeded once for the life of the connection. Seeding RAND() multiple times on the same connection can result in poor random number generation.

ROUND( num, int )

Returns num rounded to int places to the right of the decimal point. If int is negative, num is rounded to ABS(int) places to the left of the decimal point.

SIGN( num )

If num is less than zero, 1 is returned. If num equals zero, 0 is returned. If num is greater than zero, 1 is returned.

SIN( float )

Returns the sine of the float expression, where float is an angle expressed in radians.

SQRT( float )

Returns the square root of float.

TAN( float )

Returns the tangent of float, where float is an angle expressed in radians.

TRUNCATE( num, int )

Returns num truncated to int places to the right of the decimal point. If int is negative, num is truncated to ABS(int) places to the left of the decimal point.