Visible to Intel only — GUID: GUID-AB6D9564-5F9E-4365-8CFC-E45AA276F712
Visible to Intel only — GUID: GUID-AB6D9564-5F9E-4365-8CFC-E45AA276F712
NearbyInt
Computes rounded integer value in current rounding mode for each vector element.
Syntax
IppStatus ippsNearbyInt_32f (const Ipp32f* pSrc, Ipp32f* pDst, Ipp32s len);
IppStatus ippsNearbyInt_64f (const Ipp64f* pSrc, Ipp64f* pDst, Ipp32s len);
Include Files
ippvm.h
Domain Dependencies
Headers: ippcore.h
Libraries: ippcore.lib
Parameters
pSrc |
Pointer to the source vector. |
pDst |
Pointer to the destination vector. |
len |
Number of elements in the vectors. |
Description
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.
Return Values
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. |
Example
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:
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