Modulefpreviousupnextcontentsindex[BIG][Normal][small]
Next: 2.2 Programming Up: 2 Function interpreter Prev: 2 Function interpreter Index Contents


2.1 Utilization

   

The function definitions are given in free format (chapter 1), may be split over several lines, and appears between columns 1 and 72, inclusively. The general form is given below:

Function(parameter1, parameter2, ...) = expression ;

For example:

F(X,Y,Z) = (X-X**3) * (Y-Y**3) * (Z-Z**3)

+ LOG(X+Y+Z+1)

- 5.9 ;

As illustrated above, blanks are admissible and the function definition is terminated by a semi-colon (;) This format is quite natural and simple expressions should not present any difficulty. In order to take care of more complicated cases, two different presentations are given below: The first corresponds to the Fortran 77 format; the second is more formal.

2.1.1 Presentation corresponding to Fortran 77

The format is very similar to that of "statement functions" in Fortran 77, with the following differences:

 
Figure 2.1: The reserved identifiers 

2.1.2 Formal Presentation

 

Consider again the general format (section 2.1):

Function(parameter1, parameter2, ...) = expression ;

The above syntax is symbolized by the diagram in figure 2.2.

 
Figure 2.2: Diagram of the function definition 

identifier
is a non-empty sequence of letters (A-Z), underscore characters (_) and numbers (0-9). The first character must be a letter or an underscore character. The length of an identifier is only limited by the length of an input line, i.e. 72 characters. The syntax analyzer is responsible for checking that all identifiers differ from reserved words (figure 2.1).

function
is the identifier of the function to be defined, assumed to be single precision real.

parameter1, parameter2, ...
are the identifiers of the formal parameters to be evaluated in the expression, assumed to be single precision real.

expression
is a construction consisting of operands, operators and parentheses, which returns a single precision real value. The operands are parameters or numeric constants. The list of operators available is given in the following section.

a semi-colon
terminates the complete function.

The operators available

 
Figure 2.3: Priorities of operators 

Figure 2.3 gives the cardinality and priority of each prefix and infix operator:

Optimization

In order to optimize on run time and computational precision, certain exponentials are replaced automatically by multiplications. Therefore, do not hesitate to type (X+1)**2 rather than (X+1)*(X+1)!


Modulefpreviousupnextcontentsindex[BIG][Normal][small]
Next: 2.2 Programming Up: 2 Function interpreter Prev: 2 Function interpreter Index Contents