PAL Mathematics: Basic Numeric Operations

Scalar absolute values, minima/maxima, rounding, interpolation, limiting, square roots, validity checks, and small numerical utilities.

PAL Mathematics: Basic Numeric Operations — 27 functions

KiratPalAbsd

Signature
T_DOUBLE KiratPalAbsd(T_DOUBLE dValue);
Description
Calculates the element-wise absolute value/magnitude.
Mathematical operation
\(y=|x|\)

KiratPalAbsf

Signature
T_FLOAT KiratPalAbsf(T_FLOAT fValue);
Description
Calculates the element-wise absolute value/magnitude.
Mathematical operation
\(y=|x|\)

KiratPalAbsi

Signature
T_INT KiratPalAbsi(T_INT iValue);
Description
Calculates the element-wise absolute value/magnitude.
Mathematical operation
\(y=|x|\)

KiratPalAbsl

Signature
T_LONG KiratPalAbsl(T_LONG lValue);
Description
Calculates the element-wise absolute value/magnitude.
Mathematical operation
\(y=|x|\)

KiratPalCeilc

Signature
T_COMPLEX KiratPalCeilc(T_COMPLEX cValue);
Description
Rounds each element up using ceil().
Mathematical operation
\(y=\lceil\Re z\rceil+j\lceil\Im z\rceil\)

KiratPalCeilf

Signature
T_INT KiratPalCeilf(T_FLOAT fValue);
Description
Rounds each element up using ceil().
Mathematical operation
\(y=\lceil x\rceil\)

KiratPalFloatBubbleSort

Signature
void KiratPalFloatBubbleSort(T_FLOAT* pfArray, T_INT iLength);
Description
Sorts a Float array using the bubble-sort algorithm.
Mathematical operation
\(y_{(0)}\le y_{(1)}\le\cdots\le y_{(N-1)}\), where \(y\) is a permutation of the input elements.

KiratPalFloorf

Signature
T_INT KiratPalFloorf(T_FLOAT fValue);
Description
Rounds each element down using floor().
Mathematical operation
\(y=\operatorname{trunc}(x)\) (C cast from `float` to `int`); despite the function name, negative values are truncated toward zero rather than mathematically floored.

KiratPalGetMaxAbsBiasedApprox1DComplex

Signature
T_FLOAT KiratPalGetMaxAbsBiasedApprox1DComplex(const T_COMPLEX* pcVector, T_INT iSize);
Description
Returns the largest value in the array.
Mathematical operation
\(y=\max_i\left(|\Re z_i|+|\Im z_i|\right)\).

KiratPalGetMaxValAndIndex1DFloat

Signature
T_FLOAT KiratPalGetMaxValAndIndex1DFloat(const T_FLOAT* pfVector, T_INT iSize, T_INT* piIndex);
Description
Finds the maximum value (or maximum magnitude measure) and its corresponding index.
Mathematical operation
\(y=\max_{\mathbf i}x_{\mathbf i}\) and the function returns/stores an index \(\mathbf i^*\) satisfying \(x_{\mathbf i^*}=y\).

KiratPalIsNormal

Signature
T_BOOL KiratPalIsNormal(T_FLOAT fValue);
Description
Checks whether a Float value is finite and normal (not NaN/Inf, subnormal, or zero according to isnormal).
Mathematical operation
\(\operatorname{isnormal}(x)\)

KiratPalLimit

Signature
T_FLOAT KiratPalLimit(T_FLOAT fValue, T_FLOAT fMin, T_FLOAT fMax);
Description
Limits/clamps the input to a minimum and maximum value.
Mathematical operation
\(y=\max(x_{min},\min(x_{max},x))\)

KiratPalLimiti

Signature
T_INT KiratPalLimiti(T_INT iValue, T_INT iMin, T_INT iMax);
Description
Limits/clamps the input to a minimum and maximum value.
Mathematical operation
\(y=\max(x_{min},\min(x_{max},x))\)

KiratPalLinInterp

Signature
T_FLOAT KiratPalLinInterp(T_FLOAT fA, T_FLOAT fB, T_FLOAT fPercentA);
Description
Performs linear interpolation between two scalar values.
Mathematical operation
\(y=(1-p)a+pb\)

KiratPalLinInterpd

Signature
T_DOUBLE KiratPalLinInterpd(T_DOUBLE dA, T_DOUBLE dB, T_DOUBLE dPercentage);
Description
Performs linear interpolation between two scalar values.
Mathematical operation
\(y=(1-p)a+pb\)

KiratPalMaxd

Signature
T_DOUBLE KiratPalMaxd(T_DOUBLE dA, T_DOUBLE dB);
Description
Returns the maximum of two values.
Mathematical operation
\(y=\max(a,b)\)

KiratPalMaxf

Signature
T_FLOAT KiratPalMaxf(T_FLOAT fA, T_FLOAT fB);
Description
Returns the maximum of two values.
Mathematical operation
\(y=\max(a,b)\)

KiratPalMaxi

Signature
T_INT KiratPalMaxi(T_INT iA, T_INT iB);
Description
Returns the maximum of two values.
Mathematical operation
\(y=\max(a,b)\)

KiratPalMind

Signature
T_DOUBLE KiratPalMind(T_DOUBLE dA, T_DOUBLE dB);
Description
Returns the minimum of two values.
Mathematical operation
\(y=\min(a,b)\)

KiratPalMinf

Signature
T_FLOAT KiratPalMinf(T_FLOAT fA, T_FLOAT fB);
Description
Returns the minimum of two values.
Mathematical operation
\(y=\min(a,b)\)

KiratPalMini

Signature
T_INT KiratPalMini(T_INT iA, T_INT iB);
Description
Returns the minimum of two values.
Mathematical operation
\(y=\min(a,b)\)

KiratPalNaN

Signature
T_FLOAT KiratPalNaN(T_CHAR* cValue);
Description
Returns a NaN Float value.
Mathematical operation
\(y=\mathrm{NaN}\)

KiratPalNextPow2

Signature
T_INT KiratPalNextPow2(T_INT iValue);
Description
Determines a power of two suitable for the input value, typically for FFT lengths.
Mathematical operation
For the documented non-negative input range: \(y=0\) for \(x=0\); \(y=2\) for \(1\le x\le2\); and \(y=2^{\lceil\log_2x\rceil}\) for \(x>2\). The loop starts at 2, so 1 is intentionally mapped to 2.

KiratPalRound

Signature
T_INT KiratPalRound(T_FLOAT fValue);
Description
Rounds each element to the nearest integer.
Mathematical operation
\(y=\begin{cases}\operatorname{trunc}(x+0.5),&x>0,\\\operatorname{trunc}(x-0.5),&x\le0,\end{cases}\) i.e. nearest-integer rounding with half-way cases away from zero.

KiratPalSqrt

Signature
T_FLOAT KiratPalSqrt(T_FLOAT fValue);
Description
Calculates the element-wise square root.
Mathematical operation
\(y=\sqrt{x}\)

KiratPalSqrtApprox

Signature
T_FLOAT KiratPalSqrtApprox(T_FLOAT fValue);
Description
Calculates the element-wise square root.
Mathematical operation
\(y=\sqrt{x}\) in all currently implemented processor branches.

KiratPalSquare

Signature
T_FLOAT KiratPalSquare(T_FLOAT fValue);
Description
Squares a Float value.
Mathematical operation
\(y=x^2\)