C++ Native Functions: spl.math
- public float64 PI()
-
Value of PI.
- Returns
-
PI value.
- <floatingpoint T> public T abs (T f)
-
Compute the absolute value.
- Parameters
-
- f
-
Input value.
- Returns
-
Absolute value of f.
- <integral T> public T abs (T f)
-
Compute the absolute value.
- Parameters
-
- f
-
Input value.
- Returns
-
Absolute value of f.
- public float32 abs (complex32 f)
-
Compute the absolute value.
- Parameters
-
- f
-
Input value.
- Returns
-
Absolute value of f.
- public float64 abs (complex64 f)
-
Compute the absolute value.
- Parameters
-
- f
-
Input value.
- Returns
-
Absolute value of f.
- <numeric T> public list<T> abs (list<T> f)
-
Compute the absolute value of a list.
- Parameters
-
- f
-
List of input values.
- Returns
-
List of the absolute values of the elements of f.
- <numeric T>[N] public list<T>[N] abs (list<T>[N] f)
-
Compute the absolute value of a list.
- Parameters
-
- f
-
List of input values.
- Returns
-
List of the absolute values of the elements of f.
- <float T> public T acos (T f)
-
Compute the arc-cosine.
- Parameters
-
- f
-
Input value.
- Returns
-
Arccosine of the input value.
- <float T> public T asin (T f)
-
Compute the arcsine.
- Parameters
-
- f
-
Input value.
- Returns
-
Arcsine of the input value.
- <float T> public T atan (T f)
-
Compute the arc-tangent.
- Parameters
-
- f
-
Input value.
- Returns
-
Arctangent of the input value.
- <numeric T> public T avg (list<T> vals)
-
Compute the average of a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Average of the input values.
- <numeric T>[N] public T avg (list<T>[N] vals)
-
Compute the average of a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Average of the input values.
- <float T> public T ceil (T f)
-
Compute the smallest integer value equal to or greater than a value.
- Parameters
-
- f
-
Input value.
- Returns
-
Smallest integer >= f.
- public decimal32 ceil (decimal32 f)
-
Compute the smallest integer value equal to or greater than a value.
- Parameters
-
- f
-
Input value.
- Returns
-
Smallest integer >= f.
- public decimal64 ceil (decimal64 f)
-
Compute the smallest integer value equal to or greater than a value.
- Parameters
-
- f
-
Input value.
- Returns
-
Smallest integer >= f.
- <float T> public T cos (T f)
-
Compute the cosine.
- Parameters
-
- f
-
Input value.
- Returns
-
Cosine of the input value.
- <complex T> public T exp (T val)
-
Compute e to a power.
- Parameters
-
- val
-
Input value.
- Returns
-
The base of natural logarithms, e, raised to the power given by the input value.
- <floatingpoint T> public T exp (T val)
-
Compute e to a power.
- Parameters
-
- val
-
Input value.
- Returns
-
The base of natural logarithms, e, raised to the power given by the input value.
- <floatingpoint T> public T floor (T f)
-
Compute the largest integer value equal to or less than a value.
- Parameters
-
- f
-
Input value.
- Returns
-
Largest integer <= f.
- <float T> public T fmod (T x, T y)
-
Return the floating point remainder (see man 3 fmod for details and return values).
- Parameters
-
- x
-
Dividend.
- y
-
Divisor.
- Returns
-
Floating point remainder x - n*y for some n.
- public float32 imag (complex32 c)
-
Return the 'imaginary' part of a complex number.
- Parameters
-
- c
-
Complex number input.
- Returns
-
'Imaginary' part of complex number.
- public float64 imag (complex64 c)
-
Return the 'imaginary' part of a complex number.
- Parameters
-
- c
-
Complex number input.
- Returns
-
'Imaginary' part of complex number.
- public float64 infl ()
-
Return a float64 infinity.
- Returns
-
Infinity value as float64.
- public float32 infw ()
-
Return a float32 infinity.
- Returns
-
Infinity value as float32.
- <complex T> public boolean isInf (T f)
-
Return whether the complex value is an infinity.
- Parameters
-
- f
-
Input value.
- Returns
-
The result 'true' if either the real or imaginary component is an infinite value, 'false' otherwise.
- <floatingpoint T> public boolean isInf (T f)
-
Return whether the floating point value is an infinity.
- Parameters
-
- f
-
Input value.
- Returns
-
The result 'true' if the value is an infinity, 'false' otherwise.
- <complex T> public boolean isNaN (T f)
-
Return whether the complex value is a NaN (Not A Number).
- Parameters
-
- f
-
Input value.
- Returns
-
The result 'true' if either the real or imaginary component is a NaN, 'false' otherwise.
- <floatingpoint T> public boolean isNaN (T f)
-
Return whether the floating point value is a NaN (Not A Number).
- Parameters
-
- f
-
Input value.
- Returns
-
The result 'true' if the value is a NaN, 'false' otherwise.
- <ordered T> public T kthelem (list<T> vals, uint32 k)
-
Compute the kth element in ascending order.
- Parameters
-
- vals
-
List of input values.
- k
-
The desired element (indexing starts from 0).
- Returns
-
The kth element in ascending order.
- Throws
-
- SPLRuntimeInvalidIndexException
-
If the index is out of bounds.
- <ordered T>[N] public T kthelem (list<T>[N] vals, uint32 k)
-
Compute the kth element in ascending order.
- Parameters
-
- vals
-
List of input values.
- k
-
The desired element (indexing starts from 0).
- Returns
-
The kth element in ascending order.
- Throws
-
- SPLRuntimeInvalidIndexException
-
If the index is out of bounds.
- <complex T> public T lg (T f)
-
Compute log base 10.
- Parameters
-
- f
-
Input value.
- Returns
-
Base 10 logarithm of the input value.
- <floatingpoint T> public T lg (T f)
-
Compute log base 10.
- Parameters
-
- f
-
Input value.
- Returns
-
Base 10 logarithm of the input value.
- <complex T> public T ln (T f)
-
Compute log base e.
- Parameters
-
- f
-
Input value.
- Returns
-
Natural logarithm of the input value.
- <floatingpoint T> public T ln (T f)
-
Compute log base e.
- Parameters
-
- f
-
Input value.
- Returns
-
Natural logarithm of the input value.
- <complex T> public T log (T f)
-
Compute log base e.
- Parameters
-
- f
-
Input value.
- Returns
-
Natural logarithm of the input value.
- <floatingpoint T> public T log (T f)
-
Compute log base e.
- Parameters
-
- f
-
Input value.
- Returns
-
Natural logarithm of the input value.
- <complex T> public T log10 (T f)
-
Compute log base 10.
- Parameters
-
- f
-
Input value.
- Returns
-
Base 10 logarithm of the input value.
- <floatingpoint T> public T log10 (T f)
-
Compute log base 10.
- Parameters
-
- f
-
Input value.
- Returns
-
Base 10 logarithm of the input value.
- <ordered T> public T max (T v1, T v2)
-
Compute the maximimum of two values.
- Parameters
-
- v1
-
First value.
- v2
-
Second value.
- Returns
-
Maximum of v1 and v2.
- <ordered T> public T max (list<T> vals)
-
Find the maximum value in a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Maximum of the input values.
- <ordered T>[N] public T max (list<T>[N] vals)
-
Find the maximum value in a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Maximum of the input values.
- <ordered T> public T median (list<T> vals)
-
Compute the median of a list for numeric types that have overloaded the arithmetic operators. For a list with an odd number of elements, it returns the median value. For a list with an even number of elements, it returns the average of the two middlemost elements;
- Parameters
-
- vals
-
List of input values.
- Returns
-
Median of the input values.
- <ordered T>[N] public T median (list<T>[N] vals)
-
Compute the median of a list for numeric types that have overloaded the arithmetic operators. For a list with an odd number of elements, it returns the median value. For a list with an even number of elements, it returns the average of the two middlemost elements;
- Parameters
-
- vals
-
List of input values.
- Returns
-
Median of the input values.
- <ordered T> public T min (T v1, T v2)
-
Compute the minimum of two values.
- Parameters
-
- v1
-
First value.
- v2
-
Second value.
- Returns
-
Minimum of v1 and v2.
- <ordered T> public T min (list<T> vals)
-
Find the minimum value in a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Minimum of the input values.
- <ordered T>[N] public T min (list<T>[N] vals)
-
Find the minimum value in a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Minimum of the input values.
- public float64 nanl ()
-
Return a float64 NaN (Not A Number).
- Returns
-
NaN value as float64.
- public float32 nanw ()
-
Return a float32 NaN (Not A Number).
- Returns
-
NaN value as float32.
- <complex T> public T pow (T val, T pwr)
-
Perform exponentiation.
- Parameters
-
- val
-
Input value.
- pwr
-
Exponent value.
- Returns
-
The input value raised to the power of the exponent.
- <floatingpoint T> public T pow (T val, T pwr)
-
Perform exponentiation.
- Parameters
-
- val
-
Input value.
- pwr
-
Exponent value.
- Returns
-
The input value raised to the power of the exponent.
- <integral T> public T pow (T val, T pwr)
-
Perform exponentiation.
- Parameters
-
- val
-
Input value.
- pwr
-
Exponent value.
- Returns
-
The input value raised to the power of the exponent.
- public stateful float64 random()
-
Return a random number.
- Returns
-
A random value in the range 0 to 1.
- public stateful list<float64> random(int32 cnt)
-
Return a list of random numbers.
- Parameters
-
- cnt
-
Number of random values to return.
- Returns
-
A list of random values each in the range 0 to 1.
- public float32 real (complex32 c)
-
Return the 'real' part of a complex number.
- Parameters
-
- c
-
Complex number input.
- Returns
-
'Real' part of complex number.
- public float64 real (complex64 c)
-
Return the 'real' part of a complex number.
- Parameters
-
- c
-
Complex number input.
- Returns
-
'Real' part of complex number.
- <floatingpoint T> public T round (T f)
-
Round a floating point value to the nearest integer.
- Parameters
-
- f
-
Input value.
- Returns
-
The input value rounded to the nearest integer.
- <float T> public T sin (T f)
-
Compute the sine.
- Parameters
-
- f
-
Input value.
- Returns
-
Sine of the input value.
- <numeric T> public T sqrt (T f)
-
Compute the square root.
- Parameters
-
- f
-
Input value.
- Returns
-
Square root of the input value.
- public stateful int32 srand (int32 seed)
-
Seed the random number generator.
- Parameters
-
- seed
-
Value to be set for random number seed.
- Returns
-
0 on success.
- <numeric T> public T stddev (list<T> vals)
-
Compute the standard deviation of a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Standard deviation of the input values.
- <numeric T> public T stddev (list<T> vals, boolean sample)
-
Compute the standard deviation of a list.
- Parameters
-
- vals
-
List of input values.
- sample
-
Whether we want sample standard deviation, or population standard deviation ('true' means sample, 'false' means population).
- Returns
-
Standard deviation of the input values.
- <numeric T>[N] public T stddev (list<T>[N] vals)
-
Compute the standard deviation of a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Standard deviation of the input values.
- <numeric T>[N] public T stddev (list<T>[N] vals, boolean sample)
-
Compute the standard deviation of a list.
- Parameters
-
- vals
-
List of input values.
- sample
-
Whether we want sample standard deviation, or population standard deviation ('true' means sample, 'false' means population).
- Returns
-
Standard deviation of the input values.
- <numeric T> public T sum (list<T> vals)
-
Compute the sum of a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Sum of the input values.
- <numeric T>[N] public T sum (list<T>[N] vals)
-
Compute the sum of a list.
- Parameters
-
- vals
-
List of input values.
- Returns
-
Sum of the input values.
- <float T> public T tan (T f)
-
Compute the tangent.
- Parameters
-
- f
-
Input value.
- Returns
-
Tangent of the input value.