v?fmod
Compute the floating-point remainder of input vector 1/input vector 2.
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, an invalid parameter error is reported and the function returns. |
Input |
src1 |
|
Input vector src1 with length len. If the pointer is null, a null pointer error is reported and the function returns. |
Input |
src2 |
|
Input vector src2 with length len. If the pointer is null, a null pointer error is reported and the function returns. |
Input |
dst |
|
Output vector dst with length len. If the pointer is null, a null pointer error is reported and the function returns. |
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
Dependencies
C: "kvml.h"
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #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 */ |