Developer Reference for Intel® Integrated Performance Primitives 2018
Computes rounded integer value in current rounding mode for each vector element.
IppStatus ippsNearbyInt_32f (const Ipp32f* pSrc, Ipp32f* pDst, Ipp32s len);
IppStatus ippsNearbyInt_64f (const Ipp64f* pSrc, Ipp64f* pDst, Ipp32s len);
ippvm.h
Headers: ippcore.h
Libraries: ippcore.lib
pSrc |
Pointer to the source vector. |
pDst |
Pointer to the destination vector. |
len |
Number of elements in the vectors. |
This function computes a rounded integer value in a current rounding mode for each element of the vector pSrc, and stores the result in the corresponding element of the vector pDst.
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when pSrc or pDst pointer is NULL. |
ippStsSizeErr |
Indicates an error when len is less than or equal to 0. |
The example below shows how to use the ippsNearbyInt function.
#include <fenv.h>
void ippsNearbyInt_32f_ sample(void)
{
const Ipp32f x[4] = {-1.883, -0.265, 0.176, 1.752};
Ipp32f y1[4], y2[4];
fesetround(FE_TONEAREST);
ippsNearbyInt_32f ( x, y1, 4 );
fesetround(FE_TOWARDZERO);
ippsNearbyInt_32f ( x, y2, 4 );
printf(" ippsNearbyInt_32f:\n");
printf(" x = %.3f %.3f %.3f %.3f \n", x[0], x[1], x[2], x[3]);
printf(" y1 = %.3f %.3f %.3f %.3f \n", y1[0], y1[1], y1[2], y1[3]);
printf(" y2 = %.3f %.3f %.3f %.3f \n", y2[0], y2[1], y2[2], y2[3]);
}
Output results:
ippsNearInt_32f:
x = -1.883 -0.265 0.176 1.752
y1 = -2.000 0.000 0.000 2.000
y2 = -1.000 0.000 0.000 1.000