v?log2
Compute the base-2 logarithm of a vector.
Interface Definition
C interface:
void vslog2(const int len, const float* src, float* dst);
void vdlog2(const int len, const double* src, double* dst);
Parameter
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
len |
Integer |
Number of elements in the input vector. If len ≤ 0, the system displays a message indicating that the value of len is invalid. |
Input |
src |
|
Input vector src with length len. If the pointer is null, the system prompts a null pointer error. |
Input |
dst |
|
Output vector dst with length len. If the pointer is null, the system prompts a null pointer error. |
Output |
Return Value
Return the result of
. For special values, see the following table.
. For special values, see the following table.
Input Value (src) |
Output Value (dst) |
|---|---|
±0 |
-inf |
<0 |
nan |
+inf |
+inf |
nan |
nan |
Dependency
C: "kvml.h"
Example
C interface:
#define N 4
const float src[N] = {2.2f, 1.0f, +INFINITY, -3.0f};
float dst[N] = {0};
vslog2(N, src, dst);
printFArr("input1:", N, src);
printFArr("output:", N, dst);
/**
* input1: 2.200 1.000 inf -3.000
* output: 1.138 0.000 inf nan
*
*/
Parent topic: Function Syntax