v?tan
Interface Definition
C interface:
void vstan(const int len, const float* src, float* dst);
void vdtan(const int len, const double* src, double* dst);
void vctan(const int len, const float complex *src, float complex *dst);
void vztan(const int len, const double complex *src, double complex *dst);
Fortran interface:
CALL VSTAN(LEN, SRC, DST);
CALL VDTAN(LEN, SRC, DST);
Parameters
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
- Each operation value returns the tangent y of the radian angle x, that is, y = tan(x). y ∈ (-INF, +INF)
- This function has a mathematical pole at π(1/2 + n). Because no general floating-point numbers can accurately represent the value at the pole, the return value for the pole cannot be considered reliable.
- For vstan and vdtan, the special values are listed in the following table.
Input Value (src)
Output Value (dst)
+0
+0
-0
-0
±inf
nan
nan
nan
Dependencies
C: "kvml.h"
Examples
C interface:
int i, len = 4;
float src[len] = {0.0f, 2.0f, inf, nan};
float* dst = (float*)malloc(sizeof(float) * len);
if (dst == NULL) {
printf("Malloc Failed!\n");
return 0;
}
vstan(len, src, dst);
/**
* Output dst:
* 0.0 -2.185039997100830 nan nan
*
*/
Fortran interface:
INTEGER :: LEN = 4
REAL(4) SRC(4)
REAL(4) DST(4)
DATA SRC /1, 2, 3, 4/
CALL VSTAN(LEN, SRC, DST)
!
! OUTPUT DST:
! 1.55740786, -2.18504000, -0.142546535, 1.15782118
!