---
title: v?remainder
description: "计算两个输入向量相除的余数。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0067.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0067.html
indexId: 6324599145c3aa030a7633c2aa26fdf5fd6390c26ccc7001399ab59b913e895f61
---
# v?remainder

计算两个输入向量相除的余数。

#### 接口定义

C interface：

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

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


#### 参数

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


#### 输出结果

每一组输入值相除的余数。| 输入值（src1） | 输入值（src2） | 输出值（dst） |
| --- | --- | --- |
| any | ±nan | nan |
| any | ±0 | nan |
| ±inf | any | nan |
| ±nan | any | nan |


#### 依赖

C: "kvml.h"


#### 示例

C interface：```
#define N 4
    const float src1[N] = {-8.0f, 25.0f, +INFINITY, -0.0f};
    const float src2[N] = {6.2f, -4.3f, -192.4, -3.1f};
    float dst[N] = {0};

    vsremainder(N, src1, src2, dst);
    printFArr("input1:", N, src1);
    printFArr("input2:", N, src2);
    printFArr("output:", N, dst);
 
    /** 
     *  input1: -8.000   25.000      inf   -0.000 
     *  input2:  6.200   -4.300 -192.400   -3.100
     *  output: -1.800   -0.800      nan   -0.000
     */
```
