AS400 Numeric Scalar Functions

The following are AS400 specific scalar functions.

ABS(N) or ABSVAL(N)
Returns the absolute value of N. N must be numeric.

ACOS(N)
Returns the arc cosine of N in radians

ANTILOG(N)
Returns the anti-log of N in base 10.

ASIN(N)
Returns the arc -sine of N in radians.

ATAN(N)
Returns the arc-tangent of N in radians.

ATANH(N)
Returns the hyperbolic arc-tangent of N in radians.

COS(N)
Returns the cosine of a number.

COSH(N)
Returns the hyperbolic-cosine of N.

COT(N)
Returns the cotangent of N.

DECIMAL(N,P,S)
Returns a packed decimal representation of N where S is the scale and P is the precision. Is S is omitted, scale of 0 is assumed.

DEGREES(X)
Returns the number of degrees in an angle.

DIGITS(X)
Returns the string representation of a number.

DOUBLE_PRECISION(X)
See FLOAT

EXP(X)
Returns the base of the natural algorythm raised to X.

FLOAT(X)
Returns a floating point X.

FLOOR(X)
Returns a long int version of X, truncates any existing scale.

HEX(X)
Returns the Hexidecimal value of X

INTEGER(X)
Returns X as a long integer.

LN(X)
Returns the natural logarythm of X.

LOG(X) and LOG10(X)
Both functions return common logarith of X.

MAX(E1,E2,...)
Returns the maximum expression of E1,E2, etc.

Example: Max(1,2,3) returns 3.

MIN(E1,E2,...)
Returns the minimum of expresssions E1,E2,...

Example: Min(1,2,3) returns 1.

MOD(X,Y)
Returns the modulo, remainder of division operation, of X/Y.

POWER(X,Y)
Raises X to the power Y.

SIN(X)
Returns the sine of a number.

SINH(X)
Returns the hyperbolic sine of number X.

SQRT(X)

Returns the square root of X.

TAN(X)
Returns the tangent of number X.

TANH(X)
Returns the hyperbolic tangent of number X.

ZONED(N,P,S)
Returns a zoned decimal representation of N with a precision of P and a scale of S. If S is not there, 0 is assumed.