---
title: v?round
description: "矢量计算输入的四舍五入的整数值，以浮点数返回。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/240RC1/accel/kunpengaccel_kml_16_0629.html
sourcePath: /source/zh/kunpengboostkithistory/240RC1/accel/kunpengaccel_kml_16_0629.html
indexId: 1ffb8e289ae7da8367d58b34b85e47465c4cdaaa485c222a7103460f7532607176
---
# v?round

矢量计算输入的四舍五入的整数值，以浮点数返回。

#### 接口定义

C interface：

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

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


#### 参数

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


#### 输出结果

- 每一个运算值返回x的四舍五入取整的值。
- 其他特殊值参考如下说明。| 输入值（src） | 输出值（dst） |
| --- | --- |
| +0 | +0 |
| \-0 | +0 |
| +inf | +inf |
| \-inf | \-inf |
| nan | nan |


#### 依赖

C: "kvml.h"


#### 示例

C interface：
```
float src[LEN] = {1.1f, -2.6f, INFINITY, NAN};
float* dst = (float*)malloc(sizeof(float) * LEN);
if (dst == NULL) {
printf("Malloc Failed!\n");
return;
}
vsround(LEN, src, dst);
/**
*  Output dst:
*     1.0  -3.0  INFINITY  nan
*
*/
```
