Function | Meaning | Arg. Type | Return Type |
ABS(x) | absolute value of x | INTEGER | INTEGER |
REAL | REAL | ||
SQRT(x) | square root of x | REAL | REAL |
SIN(x) | sine of x radian | REAL | REAL |
COS(x) | cosine of x radian | REAL | REAL |
TAN(x) | tangent of x radian | REAL | REAL |
ASIN(x) | arc sine of x | REAL | REAL |
ACOS(x) | arc cosine of x | REAL | REAL |
ATAN(x) | arc tangent of x | REAL | REAL |
EXP(x) | exp(x) | REAL | REAL |
LOG(x) | natural logarithm of x | REAL | REAL |
Note that all trigonometric functions use radian rather than degree for measuring angles. For function ATAN(x), x must be in (-PI/2, PI/2). For ASIN(x) and ACOS(x), x must be in [-1,1].
Function | Meaning | Arg. Type | Return Type |
INT(x) | integer part x | REAL | INTEGER |
NINT(x) | nearest integer to x | REAL | INTEGER |
FLOOR(x) | greatest integer less than or equal to x | REAL | INTEGER |
FRACTION(x) | the fractional part of x | REAL | REAL |
REAL(x) | convert x to REAL | INTEGER | REAL |
Function | Meaning | Arg. Type | Return Type |
MAX(x1, x2, ..., xn) | maximum of x1, x2, ... xn | INTEGER | INTEGER |
REAL | REAL | ||
MIN(x1, x2, ..., xn) | minimum of x1, x2, ... xn | INTEGER | INTEGER |
REAL | REAL | ||
MOD(x,y) | remainder x - INT(x/y)*y | INTEGER | INTEGER |
REAL | REAL |
The example below has three initialized variables A, B and C. The result is computed and saved into uninitialized variable R.
The following uses brackets to indicated the order of evaluation:REAL :: A = 1.0, B = -5.0, C = 6.0 REAL :: R R = (-B + SQRT(B*B - 4.0*A*C))/(2.0*A)
Therefore, R receives 3.0.(-B + SQRT(B*B - 4.0*A*C))/(2.0*A) --> ([-B] + SQRT(B*B - 4.0*A*C))/(2.0*A) --> (5.0 + SQRT(B*B - 4.0*A*C))/(2.0*A) --> (5.0 + SQRT([B*B] - 4.0*A*C))/(2.0*A) --> (5.0 + SQRT(25.0 - 4.0*A*C))/(2.0*A) --> (5.0 + SQRT(25.0 - [4.0*A]*C))/(2.0*A) --> (5.0 + SQRT(25.0 - 4.0*C))/(2.0*A) --> (5.0 + SQRT(25.0 - [4.0*C))/(2.0*A) --> (5.0 + SQRT(25.0 - 24.0))/(2.0*A) --> (5.0 SQRT([25.0 - 24.0]))/(2.0*A) --> (5.0 + SQRT(1.0))/(2.0*A) --> (5.0 + 1.0)/(2.0*A) --> ([5.0 + 1.0])/(2.0*A) --> 6.0/(2.0*A) --> 6.0/([2.0*A]) --> 6.0/2.0 --> 3.0