v?fmod
Interface Definition
C interface:
void vsfmod(const int len, const float* src1, const float* src2, float* dst);
void vdfmod(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, the system displays a message indicating that the value of len is invalid. |
Input |
src1 |
|
Input vector src1 with length len. If the pointer is null, the system prompts a null pointer error. |
Input |
src2 |
|
Input vector src2 with length len. If the pointer is null, the system prompts a null pointer error. |
Input |
dst |
|
Output vector dst with length len. If the pointer is null, the system prompts a null pointer error. |
Output |
Return Value
- The floating-point remainder is returned for each group of operation values. The formula is: fmod(x, y) = x - trunc(x/y) * y
- For special values, see the following table.
Input Value 1 (src1)
Input Value 2 (src2)
Output Value (dst)
any
±nan
nan
any
±0
nan
±inf
any
nan
±nan
any
nan
Dependency
C: "kvml.h"
Example
#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};
vsfmod(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 3.500 nan -0.000
*/