Common Math Functions

Command 1) Explanation & Details
abs(x: real): real; Finds the absolute value of x, which can be real or integer. The result is the same type as x.
cos(x: real): real; Finds the cosine of x which can be real or integer. x is expressed in radians. The result is always real.
dec(var x: integer); Decrements the value of x by one.
exp(var x: real): real; Returns the result of the exponentional function ex.
high(x: array of...):integer; Returns the upper index limit of the array x.
inc(var x: integer); Increments the value of x by one.
IsNaN(var x: double): boolean; Returns TRUE if the parameter x is not a number (NaN).
int(x: real): real; Returns the nearest integer below the given real x. No conversion is performed (in contrast to the function trunc).
length(x: string/dynamic array): integer; Returns the number of characters in a string or the number of elements in an array x.
ln(var x: real): real; Returns the natural logarithm of x.
low(x: array of...):integer; Returns the lower index limit of the array x.
nrand(stddev: real): real; Returns a normally distributed random number exhibiting a zero mean and a standard deviation specified by the parameter stddev.
pi Returns the value of Pi (= 3.14159265....)
power(base, expo: real): real calculates the power function: result = baseexpo
rand(amplitude: real): real; Returns a uniformly distributed random number in the range between -amplitude/2 and +amplitude/2. The mean of the random number is zero. In order to create integer random numbers from 1 to N, please use the following formula: round(rand(N)+N/2+0.5)
round(x: real): integer; Finds the nearest integer to the given real x.
sin(x: real): real; Finds the sine of x, which can be real or integer. x is expressed in radians. The result is always real.
sqr(x: real):real; Finds the square of x, which can be real or integer. The result is always real.
sqrt(x: real): real; Finds the square root of x, which can be real or integer. The result is always real.
Example: sqrt(myvar)
trunc(x: real): integer; Finds the nearest integer below the given real x (converts a real to an integer).



1) Please note that the data type "real" is a placeholder and means either "single", "double", or "extended" depending on the declaration of the involved variables.