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);

Parameters

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

len

Number of elements in the vectors.

Description

The function ippsNearbyInt is declared in the ippvm.h file. 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.

The example below shows how to use the ippsNearbyInt function.

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.

Using 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, y2, 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
y = -2.000  0.000 0.000 2.000
y = -1.000  0.000 0.000 1.000

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.