Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 10/31/2024
Public
Document Table of Contents

Rint

Computes rounded integer value in current rounding mode for each vector element with inexact result exception raised for each changed value.

Syntax

IppStatus ippsRint_32f (const Ipp32f* pSrc, Ipp32f* pDst, Ipp32s len);

IppStatus ippsRint_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 raising inexact result exception if the value has changed.

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 ippsRint function.

#include <fenv.h>

void ippsRint_32f_ sample(void) {
	const Ipp32f x[4] = {-1.883, -0.265, 0.176, 1.752};
	Ipp32f y1[4], y2[4];
	fesetround(FE_TONEAREST);
	ippsRint_32f ( x, y1, 4 );
	fesetround(FE_TOWARDZERO);
	ippsRint_32f ( x, y2, 4 );
	
	printf(" ippsRint_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:

ippsRint_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