<< Click to Display Table of Contents >> Navigation: Explain™ Control Language > Library Routines > Mathematical functions |
Basic math functions used in Explain scripts files (*.exp):
Calculate the absolute value of a number. The number a REAL. The value returned is the same type as the argument.
number |
REAL |
The number for which the absolute value is desired. |
result |
REAL |
The absolute value of number. |
Calculate the absolute value of a number. The number an INDEX. The value returned is the same type as the argument.
number |
INDEX |
The number for which the absolute value is desired. |
result |
INDEX |
The absolute value of number. |
Calculate ex.
number |
REAL |
The exponent of e. Calculate enumber. |
result |
REAL |
The result of enumber. |
Convert REAL, BITS, BOOL, or STRING to an INDEX.
item |
REAL, BITS, BOOL, or STRING |
item to be converted to an INDEX. |
result |
INDEX |
The converted item. |
Return a sample time that will result in successive samples 180° out of phase with the AC power line frequency.
OldTime |
REAL |
The time used as the basis for the calculation. |
result |
REAL |
The time calculated to result in successive sample that are out of phase with the AC power line. |
Calculate the natural (base e) logarithm of a number.
If number < 0, the absolute value is taken first. |
number |
REAL |
number to find the log of. |
result |
REAL |
The calculated result. |
Calculate the base-10 logarithm of a number.
If number < 0, the absolute value is taken first. |
number |
REAL |
number to find the log10 of. |
result |
REAL |
The calculated result. |
Calculate the modulus of a complex number.
RealPart |
REAL |
Real part of the complex number. |
ImagPart |
REAL |
Imaginary part of the complex number. |
result |
REAL |
The calculated result. |
Calculate the phase in degrees of a complex number.
RealPart |
REAL |
Real part of the complex number. |
ImagPart |
REAL |
Imaginary part of the complex number. |
result |
REAL |
The calculated result. |
Calculate a number raised to a power, xy.
X |
REAL |
Base value. |
Y |
REAL |
Exponent. |
result |
REAL |
The calculated result. |
Calculate a random number from 0 to RAND_MAX (32767).
The result varies depending on the input number. |
number |
INDEX |
NIL |
result |
INDEX |
The randomly generated number: 0 < result < RAND_MAX |
number |
INDEX |
number < 0 |
result |
INDEX |
The randomly generated number: result = RAND_MAX |
number |
INDEX |
number > 0 |
result |
INDEX |
The randomly generated number. Random number generator is re-seeded. |
Convert INDEX, BITS, BOOL, or STRING to a REAL.
item |
INDEX, BITS, BOOL, or STRING |
item to be converted to an REAL. |
result |
REAL |
The converted item. |
Round a REAL value to a known number of decimal places.
number |
REAL |
The number to be rounded. |
places |
INDEX |
The number of decimal places desired. |
result |
REAL |
The resulting number. |
Calculate the square root of a number.
If number < 0, the absolute value is taken first. |
number |
REAL |
The number to square-rooted. |
result |
REAL |
The calculated result. |