Mathematical Functions

The argument arg of a mathematical function must represent a numeric value. The data type of the return value is determined either by the argument of the function (overloaded functions) or by the function itself (floating point functions).

Outside of an arithmetic expression, the argument of a mathematical function must be a single, numeric data object. Within an arithmetic expression - that is, in the statement COMPUTE - the argument of a mathematical function can also be an arithmetic expression. In particular, a mathematical function in an arithmetic expression can have a different built-in function or a functional method as argument.

Overloaded Functions

The following table shows the overloaded functions where the data type of the argument determines the data type of the return value.

Function func Return value
abs Absolute value of the argument arg
sign Plus/minus sign of the argument arg: -1, if the value of arg is negative; 0 if the value of arg is 0; 1 if the value of arg is positive.
ceil Smallest integer number that is not smaller than the value of the argument arg.
floor Largest integer number that is not larger than the value of the argument arg.
trunc Value of the integer part of the argument arg
frac Value of the decimal places of the argument arg

If the argument of an overloaded function does not have any numeric data type i, p, or f, its data type determines the type of return value as follows:

Before the function is calculated, the argument is converted into the respective type:

Floating Point Functions

The following table shows the floating point functions where the return value is always of the type f. Floating point functions expect an argument of the type f. Data objects of other data types are converted, before calculation of the function, into the data type f.

Funktion func Meaning Definition Area
acos Arcuscosinus [-1,1]
asin Arcussinus [-1,1]
atan Arcustangens
cos Cosinus
sin Sinus
tan Tangens
cosh Hyperbelcosinus
sinh Hyperbelsinus
tanh Hyperbeltangens
exp Exponential function for basis e [-709, 710]
log Natural logarithm > 0
log10 Logarithm for basis 10 > 0
sqrt Square root >= 0

For the functions for which a definition area is specified, the value of arg must be in the specified limits. For the exponential function exp an error-free execution is guaranteed for the arguments within the definition ares, because the results then lie within the value range for floating point numbers according to IEEE-754. For arguments smaller than -709, the result is always 0, depending on the platform, or as of a certain value a treatable exception of class CX_SY_ARITHMETIC_OVERFLOW is triggered. For arguments greater than +718, it also leads to this exception. The trigonometry functions sin, cos, and tan are defined for arbitrary arguments, but the results are inexact whenever the amount of the argument is greater than approximately 100.000.000.

Note

The function atan may be undefined for odd-numbered multiples of pi/2, but the definition area for atan is not limited, because an argument of the functions can never contain exactly the value of pi/2.

Exceptions that can be handled

The exceptions that can be handled and can occur during calculation of a mathematical function are subclasses of the classes CX_SY_ARITHMETIC_ERROR und CX_SY_CONVERSION_ERROR.