Mathematical functions supported from the C/C++ Math library are as shown in the table below.
Figure 3.108: Supported mathematical functions
Functions | Description | |
ABS(E1) | Definition | Use to compute the absolute value of E1. |
Input (E1) | Real | |
Return Value | Real ≥ 0 | |
Example | ABS(-1.5) = 1.5 | |
ACOS(E1) | Definition | Use to compute the arc-cosine of E1. |
Input (E1) | -1 ≤ Real ≤ 1. If the input value is greater than 1 or less than -1, it will be limited 1 or -1, respectively. | |
Return Value | 0 ≤ Real < PI in Radians | |
Example | ACOS(0.5) = PI/3 | |
AINT(E1) | Definition | Use to truncate E1 to the whole number. |
Input (E1) | Real | |
Return Value | Integer. If the magnitude of E1 is less than 1, then AINT(E1) returns 0. If the magnitude is equal to or greater than 1, then it returns the largest whole number that does not exceed its magnitude. The sign is the same as the sign of E1. | |
Example | AINT(-1.5678) = -1, AINT(0.17) = 0 | |
ANINT(E1) | Definition | Use to round E1 to the nearest whole number. |
Input (E1) | Real | |
Return Value | Integer. If E1 is greater than 0, then ANINT(X) returns AINT(E1+0.5). If E1 is less than or equal to 0, then return AINT(E1-0.5). | |
Example | ANINT(0.4) = 0, ANINT(-1.9) = -2 | |
ASIN(E1) | Definition | Use to compute the arcsine of E1. |
Input (E1) | -1 ≤ Real ≤ 1. If the input value is greater than 1 or less than -1, it will be limited 1 or -1, respectively. | |
Return Value | -PI/2 ≤ Real ≤ PI/2 in Radians. | |
Example | ASIN(0.5) = PI/6 | |
ATAN(E1) | Definition | Use to compute the arctangent of E1. |
Input (E1) | Real | |
Return Value | -PI/2 ≤ Real ≤ PI/2 in Radians. | |
Example | ATAN(1.0) = PI/4 | |
ATAN2(E1,E2) | Definition | Use to compute the arctangent of E2/E1. |
Input (E1,E2) | Real | |
Return Value |
-PI < Real ≤ PI in Radians. The return value can be computed under several conditions as follows. 1) E1 > 0 → ATAN(E2/E1) 2) E1 < 0 & E2 ≥ 0 → ATAN(E2/E1) + PI 3) E1 < 0 & E2 ≤ 0 → ATAN(E2/E1) - PI 4) E1 = 0 & E2 > 0 → PI/2 5) E1 = 0 & E2 < 0 → -PI/2 6) E1 = 0 & E2 = 0 → 0 | |
Example | ATAN2(1.0,-1.0) = 3*PI/4, ATAN2(-1.0,1.0) = -PI/4 | |
CEIL(E1) | Definition | Use to return the least integer greater than or equal to E1. |
Input (E1) | Real | |
Return Value | Integer | |
Example | CEIL(0.4) = 1, CEIL(-0.9) = 0 | |
COS(E1) | Definition | Use to compute the cosine of E1. |
Input (E1) | Real (Radians) | |
Return Value | Real | |
Example | COS(PI/3) = 0.5 | |
COSH(E1) | Definition | Use to compute the hyperbolic cosine of E1. |
Input (E1) | Real (Radians) | |
Return Value | Real | |
Example | COSH(PI/18) = 1.01526957 | |
DIM(E1,E2) | Definition | Use to compute the difference E1-E2 if the result is positive. Otherwise returns zero. |
Input (E1,E2) | Real | |
Return Value | Real ≥ 0 | |
Example | DIM(2,1) = 1, DIM(1,2) = 0 | |
EXP(E1) | Definition | Use to compute the base e exponential of E1. |
Input (E1) | Real | |
Return Value | Real | |
Example | EXP(1.0) = e (Euler's number) | |
FLOOR(E1) | Definition | Use to return the greatest integer less than or equal to E1. |
Input (E1) | Real | |
Return Value | Integer | |
Example | FLOOR(0.4) = 0, FLOOR(-0.9) = -1 | |
INT(E1) | Definition | Use to truncate x to the whole number. |
Input (E1) | Real | |
Return Value | Integer. If the magnitude of x is less than 1, then INT(E1) returns 0. If the magnitude is equal to or greater than 1, then it returns the largest whole number that does not exceed its magnitude. The sign is the same as the sign of x. | |
Example | ||
LOG(E1) | Definition | Use to compute the natural (base e) logarithm of E1. |
Input (E1) | Real > 0 | |
Return Value | Real | |
Example | LOG(2.7182818) = 1.0 | |
LOG10(E1) | Definition | Use to compute the base 10 logarithm of E1. |
Input (E1) | Real > 0 | |
Return Value | Real | |
Example | LOG(100.0) = 2.0 | |
MAX(E1,E2) | Definition | Use to return the maximum value of E1 and E2. |
Input (E1,E2) | Real | |
Return Value | Real | |
Example | MAX(1,2) = 2 | |
MIN(E1,E2) | Definition | Use to return the minimum value of E1 and E2. |
Input (E1,E2) | Real | |
Return Value | Real | |
Example | MIN(1,2) = 1 | |
MOD(E1,E2) | Definition | Use to computes the remainder of the division of E1 by E2. |
Input (E1,E2) | Real. E2 must be not equal to zero. | |
Return Value |
Real. The return value can be calculated as follows. E1 - INT(E1/E2) * E2. | |
Example | MOD(9,4) = 1 | |
POW(E1,E2) | Definition | Use to computes E1 raised to the power of E2. |
Input (E1,E2) | Real. E1 must be not equal to zero. | |
Return Value |
Real. The return value can be computed under several conditions as follows. 1) E1 > 0 → E1^E2 2) E1 = 0 & E2 > 0 → 0 3) E1 = 0 & E2 = 0 → 1 4) E1 = 0 & E2 < 0 → 0 5) E1 < 0 & E2 is an integer number. → E1^E2 6) E1 < 0 & E2 has a finite decimal. → 0 For 4) case and 6) cases, the return value is not calculated but actually Motion solver returns zero value. | |
Example | POW(2,4) = 16 | |
RAND(E1,E2) | Definition | Use to returns a pseudo-random number from a uniform distribution between E1 and E2. |
Input (E1,E2) | Real. E2 must be greater than E1. | |
Return Value | Real | |
Example | RAND(6,9) = 6, 7, 8 or 9 | |
SIGN(E1,E2) | Definition | Use to return the value of E1 with the sign of E2. |
Input (E1,E2) | Real | |
Return Value | Real | |
Example | SIGN(7,-1) = -7, SIGN(-7,-1) = -7, SIGN(-7,1) = 7 | |
SIN(E1) | Definition | Use to compute the sine of E1. |
Input (E1) | Real (Radians) | |
Return Value | Real | |
Example | SIN(PI/6) = 0.5 | |
SINH(E1) | Definition | Use to compute the hyperbolic sine of E1. |
Input (E1) | Real (Radians) | |
Return Value | Real | |
Example | SINH(PI/18) = 0.17542037 | |
SQRT(E1) | Definition | Use to compute the square root of E1. |
Input (E1) | Real ≥ 0 | |
Return Value | Real ≥ 0 | |
Example | SQRT(4) = 2 | |
TAN(E1) | Definition | Use to compute the tangent of E1. |
Input (E1) | Real in Radians. E1 must be not equal to (2N-1)*PI/2. | |
Return Value | Real | |
Example | TAN(PI/4) = 1.0 | |
TANH(E1) | Definition | Use to compute the hyperbolic tangent of E1. |
Input (E1) | Real (Radians) | |
Return Value | Real | |
Example | TANH(PI/18) = 0.172782 |