Rate This Document
Findability
Accuracy
Completeness
Readability

v?atan2pi

Compute the arctangent of src1/src2 and divide the arctangent by π. src1, src2, and the result are all vectors.

Interface Definition

C interface:

void vsatan2pi(const int len, const float* src1, const float* src2, float* dst);

void vdatan2pi(const int len, const double* src1, const double* src2, double* dst);

Parameters

Parameter

Type

Description

Input/Output

len

Integer

Number of elements in the input vector.

If len ≤ 0, an invalid parameter error is reported and the function returns.

Input

src1

  • Single-precision floating-point type for vsatan2pi
  • Double-precision floating-point type for vdatan2pi

Input vector src1 with length len.

If the pointer is null, a null pointer error is reported and the function returns.

Input

src2

  • Single-precision floating-point type for vsatan2pi
  • Double-precision floating-point type for vdatan2pi

Input vector src2 with length len.

If the pointer is null, a null pointer error is reported and the function returns.

Input

dst

  • Single-precision floating-point type for vsatan2pi
  • Double-precision floating-point type for vdatan2pi

Output vector dst with length len.

If the pointer is null, a null pointer error is reported and the function returns.

Output

Return Value

  • The value of each operation value's arctangent divided by π is returned. The value range is [-1, +1].
  • For special values, see the following table.

    Input Value 1 (src1)

    Input Value 2 (src2)

    Output Value (dst)

    ±0

    -0

    ±1

    ±0

    +0

    ±0

    ±∞

    finite

    ±1/2

    ±∞

    -∞

    ±3/4

    ±∞

    +∞

    ±1/4

    <0

    ±0

    -1/2

    >0

    ±0

    -1/2

    +finite

    -inf

    +1

    -finite

    -inf

    -1

    +finite

    +inf

    +0

    -finite

    +inf

    -0

    nan

    any

    nan

    any

    nan

    nan

Dependencies

C: "kvml.h"

Examples

C interface:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
    int i, len = 4; 
    float src1[len] = {0.0f, 1.0f, -inf, inf}; 
    float src2[len] = {0.0f, 2.0f, INFINITY, NAN}; 
    float* dst = (float*)malloc(sizeof(float) * len); 
    if (dst == NULL) { 
        printf("Malloc Failed!\n"); 
        return 0; 
    } 
    vsatan2pi(len, src1, src2, dst); 
    /** 
     *  Output dst: 
     *     0.0  0.14758362  -0.25  nan 
     * 
     */