---
title: v?tanpi
description: "计算输入值乘以π的正切值，输入为向量。"
url: https://www.hikunpeng.com/document/detail/zh/hpchistory/hpckit/develop2400/kunpengaccel_kml_0112.html
sourcePath: /source/zh/hpchistory/hpckit/develop2400/kunpengaccel_kml_0112.html
indexId: 50357bf1f57802c9ffddc0fb981e20ca8c919257cc5990b7c3a62b58dacc6f7b67
---
# v?tanpi

计算输入值乘以π的正切值，输入为向量。

#### 接口定义

C interface：

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

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


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| len | 整型数 | 表示输入向量的元素个数。 len≤0时会提示len无效并返回。 | 输入 |
| src | 在vstanpi中是单精度浮点类型。 在vdtanpi中是双精度浮点类型。 | 输入向量src，向量长度为len。 若为空指针，会提示空指针错误并返回。 | 输入 |
| dst | 在vstanpi中是单精度浮点类型。 在vdtanpi中是双精度浮点类型。 | 输出dst，向量长度为len。 若为空指针，会提示空指针错误并返回。 | 输出 |


#### 输出结果

- 每一个运算值返回x乘以π的正切函数值y=tan(x * π), y ∈ (-INF, +INF)。
- 其他特殊值参考如下说明。| 输入值（src） | 输出值（dst） |
| --- | --- |
| +0 | +0 |
| \-0 | \-0 |
| ±inf | nan |
| nan | nan |


#### 依赖

C: "kvml.h"


#### 示例

C interface：

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

    /** 
     *  Output dst: 
     *     0.000000 -0.000000 -nan -nan
     */
```
