Numeric Functions

Updated July 2016; see History

These functions all return numeric values, although some may operate on string arguments.

Function

Description

ABS(x)

Returns absolute value of x.

EXP(x)

Returns the constant e (2.718218285) raised to the power x.

FACT(x)

Returns the factorial of x.

FIX(x)

Returns the integer part of the floating point value x.

INT(x)

Returns the largest integer less than or equal to x. (FIX(x) and INT(x) are same for positive numbers, but differ for negative numbers)

LEN(a$)

Returns length of string A$. Note that if a$ is actually a variable of type x, the returned length will always be the physical mapped size of the variable. Otherwise, for strings (type S), the returned length will be determined by the first null byte or the physical mapped length, whichever is smaller.

LOG(x)

Returns the natural (base e) log of x.

LOG10(x)

Returns the decimal logarithm of x.

RND(x)

Depending on x, either returns a pseudorandom value in the range of 0 to 1 based on a previously set seed, or establishes the seed. See RND2() for an enhanced implementation.

RND2()

Returns the next random number per the initialization/state set by SRND2(x,...). Enhanced version of RND(x).

SRND2(x...)

Initializes the RND2() generator.

SGN(x)

Returns the sign of x: -1 if x < 0, 0 if x = 0, 1 if x > 0.

SQR(x)

Returns the square root of x.

 

History

2016 July, A-Shell 6.3.1517:  Add second random number generator, RND2 and SRND2.