---
title: v?log1p
description: "矢量计算以e为底(1+x)为输入的对数值。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/accel/kunpengaccel_kml_16_0354.html
sourcePath: /source/zh/kunpengboostkithistory/2300/accel/kunpengaccel_kml_16_0354.html
indexId: 357bf73b1d932273ca4e3d70b90c46d28c2689c658907c182fa49c8ce579c86c74
---
# v?log1p

矢量计算以e为底(1+x)为输入的对数值。

#### 接口定义

C interface：

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

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


#### 参数

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


#### 输出结果

输出的值。其他特殊值参考如下说明。| 输入值（src） | 输出值（dst） |
| --- | --- |
| \-1 | \-inf |
| <\-1 | nan |
| +0 | +0 |
| \-0 | \-0 |
| \-inf | nan |
| +inf | +inf |
| nan | nan |


#### 依赖

C: "kvml.h"


#### 示例

C interface：

```
#define N 4
const float src[N] = {-2.2f, 1.0f, +INFINITY, -0.0f};
float dst[N] = {0};
vslog1p(N, src, dst);
printFArr("input1:", N, src);
printFArr("output:", N, dst);
/**
*  input1:  -2.200    1.000      inf   -0.000
*  output:     nan    0.693      inf   -0.000
*
*/
```
