Basic math functions used in Explain Scripts. More...
Data type | Name and description |
REAL |
Abs (REAL number) Calculate the absolute value of a number. More... |
INDEX |
Abs (INDEX number) Calculate the absolute value of a number. More... |
REAL |
Exp (REAL number) Calculates ex. More... |
INDEX |
Index (ANY_TYPE Item) Converts REAL, BITS, BOOL, or STRING to an INDEX. More... |
REAL |
LineOpt (REAL OldTime) Returns a sample time that will result in successive samples 180° out of phase with the AC power-line (mains) frequency. More... |
REAL |
Log (REAL number) Calculate the natural (base e) logarithm of a number. More... |
REAL |
Log10 (REAL number) Calculate the base-10 logarithm of a number. More... |
REAL |
Modulus (REAL RealPart, REAL ImagPart) Calculate modulus of a complex number. More... |
REAL |
Phase (REAL RealPart, REAL ImagPart) Calculate the phase in degrees of a complex number. More... |
REAL |
Pow (REAL X, REAL Y) Calculate a number x raised to a power y, xy. More... |
INDEX |
Rand (INDEX number) Create a random number from 0 to RAND_MAX (32767). More... |
REAL |
Real (ANY_TYPE Item) Convert INDEX, BITS, BOOL, or STRING to a REAL. More... |
REAL |
Round (REAL numbers, INDEX places) Round a REAL value to a known number of decimal places. More... |
REAL |
Sqrt (REAL number) Calculates the square root of a number. More... |
Calculate the absolute value of a number. The number can be an INDEX or a REAL. The value returned is the same type as the argument.
Number The number for which the absolute value is desired.
Result The absolute value of Number
INDEX Abs (INDEX number
Calculate the absolute value of a number.
The value returned is the same type as the argument.
Number The number for which the absolute value is desired.
Result The absolute value of Number
Calculate ex.
Number The exponent of e
Result The result of eNumber
Convert REAL, BITS, BOOL, or STRING to an INDEX.
Item Item to be converted to an INDEX
Converted The converted Item
Return a sample time that will result in successive samples 180 degrees out of phase with the AC power line frequency.
OldTime The time used as the basis for the calculation.
NewTime 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.
Number Number to find the log of.
If Number < 0, the absolute value is taken first.
Result The calculated result
Calculate the base-10 logarithm of a number.
If Number < 0, the absolute value is taken first.
Number Number to find the log10 of.
Result The calculated result
REAL Modulus ( REAL RealPart, REAL ImagPart )
Calculate modulus of a complex number.
Modulus = sqrt(Re*Re + Im*Im)
RealPart Real part of the complex number.
ImagPart Imaginary part of the complex number.
Result The result of the calculation.
REAL Phase ( REAL RealPart, REAL ImagPart )
Calculate the phase in degrees of a complex number.
Phase = arctan(im/re)
RealPart Real part of the complex number.
ImagPart Imaginary part of the complex number.
Result The result of the calculation.
Calculate a number raised to a power, xy.
X Base value
Y Exponent
Result The result of the calculation.
Calculate a random number from 0 to RAND_MAX (32767).
Number Can be any one of the following values:
Value Result
Number = NIL 0 < Result < RAND_MAX
Number < 0 Result = RAND_MAX
Number > 0 Random number generator is re-seeded
Result The randomly generated number
Convert INDEX, BITS, BOOL, or STRING to a REAL.
Anything other than a legal arguments is converted to 0.000
Item Item to be converted to a REAL
Converted The converted Item
REAL Round ( REAL Numbers, INDEX Places)
Round a REAL value to a known number of decimal places.
Number The quantity to be rounded
Places The number of decimal places desired.
Rounded The resulting number
Calculates the square root of a number.
Number The number to square-rooted.
If Number < 0, the absolute value is taken first.
Result The calculated result.