In the programs we have developed in this course material, we have come across many functions, the use of which we have covered as we needed to. The functions we have used are covered in the Command Index. This brief section is to outline some of the other regularly used functions available that we have not used in the course. This list of functions is not exhaustive, but is intended to give a flavour of the functionality available in in Pascal.
Math Functions
Function
Usage
abs
Abs(number) returns the absolute value of number - the return value is of the same datatype as the parameter.
cos
Cos(angle) returns the cosine of the radian parameter. The other trigonometric calculations are also available, sin, tan, arccos, arcsin, arctan.
trunc
Returns the integer value of the argument
round
Round (x); returns the nearest integer value to x
exp
exp(x); returns e to the power of x.
ln
ln(x); returns the natural log of x.
sqr
sqr (x); returns the square of x
Text and String Functions
We have used a number of text functions including delete, copy and pos. Some other text manipulation functions available are :
Function
Usage
Val
Val (stringvar, numvar, errno). Where stringvar is a string containing numerical data, converts the number to numeric format and places it in numvar. If successful, errno is zero, if an error occurs in the conversion, errno is non-zero.
Str
Str (numvar, format, stringvar). Converts a number, in numvar to specified format and stores it as a string in stringvar.
Concat
Concat (str1, str2...); Concatenates a series of strings together
Insert
Insert (ins_string, longstring, position). Inserts ins_string into longstring at position.