Functions
The general form of calling a function is:
FUNCTION (<param1>, <param2>, ... <paramN>) |
Currently defined functions are:
Trigonometric functions and angular calculations
For the trigonometric functions, input values are expected to be in degrees and decimals of a degree (DDD.DDDD) as are the results.
Function | Description |
---|---|
SIN(x) | Returns the SINE of x. |
COS(x) | Returns the COSINE of x. |
TAN(x) | Returns the TANGENT of x. |
ASIN(x) | Returns the ARCSINE of x. |
ACOS(x) | Returns the ARCCOSINE of x. |
ATAN(x) | Returns the ARCTANGENT of x. |
ATAN2(y, x) | Returns the ARCTANGENT of y/x. (if x equals 0, ATAN2 returns 180 if y is positive, -180. if y is negative, or 0 if y is 0.) If either x or y is undefined, the return value is undefined. |
ADDANGLE(x1, x2, ... xn) | Adds up all passed parameters, making sure the result is in the range [0, 360). |
SUBANGLE(x1, x2, ... xn) | Subtracts all passed parameters, making sure the result is in the range [0, 360). |
DMS2DEG(x) | Converts an angle in DMS format (x) to decimal degrees. |
DEG2DMS(x) | Converts an angle in decimal degrees format (x) to DMS format. |
Tips
- Be aware of the type conversion in your expression. Remember that apart from a few exceptions, the type of the result is the type of the leftmost operand. Note therefore, that “5" + 5 equals “55" and not 10. Note also that if any operand is undefined the result of the expression will also be undefined.
- Remember that the variable type is the type of the corresponding file field.
- Function and variable names referred to in the expression are matched only when they are actually needed to produce a value. Use the DEFINED function to ensure that a variable exists and has a value before referring to it. 2 + MCAF is unsafe, since MCAF might not exist or might not have a value.
Use 2 + if DEFINED (MCAF) then MCAF else <some_defined_value> fi instead.
- Use parentheses to ensure that the computation order is correct.
- Remember that ALL parts of the 'if' operator are compulsory. Don't forget the 'fi' to mark the end of your conditional operator.