Rate This Document
Findability
Accuracy
Completeness
Readability

v?acos

Interface Definition

C interface:

void vsacos(const int len, const float* src, float* dst);

void vdacos(const int len, const double* src, double* dst);

void vcacos(const int len, const float complex *src, float complex *dst);

void vzacos(const int len, const double complex *src, double complex *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

  • Single-precision floating-point type for vsacos
  • Double-precision floating-point type for vdacos
  • Single-precision floating-point complex type for vcacos
  • Double-precision floating-point complex type for vzacos

Input vector src with length len.

If the pointer is null, the system prompts a null pointer error.

Input

dst

  • Single-precision floating-point type for vsacos
  • Double-precision floating-point type for vdacos
  • Single-precision floating-point complex type for vcacos
  • Double-precision floating-point complex type for vzacos

Output vector dst with length len.

If the pointer is null, the system prompts a null pointer error.

Output

Return Value

  • The arccosine y of cosine x is returned. x ∈ [-1, +1]
  • For vsacos and vdacos, the special values are listed in the following table.

    Input Value (src)

    Output Value (dst)

    ±inf

    nan

    nan

    nan

    +1

    +0

    -1

    +pi

    |x|>1

    nan

  • For vcacos and vzacos, the special values are listed in the following table.

    Real Part of the Input (src.real)

    Imaginary Part of the Input (src.imag)

    Real Part of the Output (dst.real)

    Imaginary Part of the Output (dst.imag)

    0

    0

    π/2

    0

    0

    0

    π/2

    0

    0

    inf

    π/2

    -inf

    0

    -inf

    π/2

    inf

    0

    snan

    π/2

    nan

    0

    -snan

    π/2

    nan

    0

    qnan

    π/2

    nan

    0

    -qnan

    π/2

    nan

    0

    0

    π/2

    0

    0

    0

    π/2

    0

    0

    inf

    π/2

    -inf

    0

    -inf

    π/2

    inf

    0

    snan

    π/2

    nan

    0

    -snan

    π/2

    nan

    0

    qnan

    π/2

    nan

    0

    -qnan

    π/2

    nan

    inf

    0

    0

    -inf

    inf

    0

    0

    inf

    inf

    inf

    π/4

    -inf

    inf

    -inf

    π/4

    inf

    inf

    snan

    nan

    -inf

    inf

    -snan

    nan

    -inf

    inf

    qnan

    nan

    -inf

    inf

    -qnan

    nan

    -inf

    -inf

    0

    π

    -inf

    -inf

    0

    π

    inf

    -inf

    inf

    3*π/4

    -inf

    -inf

    -inf

    3*π/4

    inf

    -inf

    snan

    nan

    -inf

    -inf

    -snan

    nan

    -inf

    -inf

    qnan

    nan

    -inf

    -inf

    -qnan

    nan

    -inf

    snan

    0

    nan

    nan

    snan

    0

    nan

    nan

    snan

    inf

    nan

    -inf

    snan

    -inf

    nan

    inf

    snan

    snan

    nan

    nan

    snan

    -snan

    nan

    nan

    snan

    qnan

    nan

    nan

    snan

    -qnan

    nan

    nan

    -snan

    0

    nan

    nan

    -snan

    0

    nan

    nan

    -snan

    inf

    nan

    -inf

    -snan

    -inf

    nan

    inf

    -snan

    snan

    nan

    nan

    -snan

    -snan

    nan

    nan

    -snan

    qnan

    nan

    nan

    -snan

    -qnan

    nan

    nan

    qnan

    0

    nan

    nan

    qnan

    0

    nan

    nan

    qnan

    inf

    nan

    -inf

    qnan

    -inf

    nan

    inf

    qnan

    snan

    nan

    nan

    qnan

    -snan

    nan

    nan

    qnan

    qnan

    nan

    nan

    qnan

    -qnan

    nan

    nan

    -qnan

    0

    nan

    nan

    -qnan

    0

    nan

    nan

    -qnan

    inf

    nan

    -inf

    -qnan

    -inf

    nan

    inf

    -qnan

    snan

    nan

    nan

    -qnan

    -snan

    nan

    nan

    -qnan

    qnan

    nan

    nan

    -qnan

    -qnan

    nan

    nan

Dependency

C: "kvml.h"

Example

C interface:

    int i, len = 4; 
    float src[4] = {0.0f, 2.0f, INFINITY, NAN}; 
    float* dst = (float*)malloc(sizeof(float) * len); 
    if (dst == NULL) { 
        printf("Malloc Failed!\n"); 
        return 0; 
    } 
    vsacos(len, src, dst);

    /** 
     *  Output dst: 
     *     1.570796 nan nan nan
     */