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

ID 790148
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

SinCos

Computes sine and cosine of each vector element.

Syntax

IppStatus ippsSinCos_32f_A11 (const Ipp32f* pSrc, Ipp32f* pDst1, Ipp32f* pDst2, Ipp32s len);

IppStatus ippsSinCos_32f_A21 (const Ipp32f* pSrc, Ipp32f* pDst1, Ipp32f* pDst2, Ipp32s len);

IppStatus ippsSinCos_32f_A24 (const Ipp32f* pSrc, Ipp32f* pDst1, Ipp32f* pDst2, Ipp32s len);

IppStatus ippsSinCos_64f_A26 (const Ipp64f* pSrc, Ipp64f* pDst1, Ipp64f* pDst2, Ipp32s len);

IppStatus ippsSinCos_64f_A50 (const Ipp64f* pSrc, Ipp64f* pDst1, Ipp64f* pDst2, Ipp32s len);

IppStatus ippsSinCos_64f_A53 (const Ipp64f* pSrc, Ipp64f* pDst1, Ipp64f* pDst2, Ipp32s len);

Include Files

ippvm.h

Domain Dependencies

Headers: ippcore.h

Libraries: ippcore.lib

Parameters

pSrc

Pointer to the first source vector.

pDst1

Pointer to the destination vector for sine values.

pDst2

Pointer to the destination vector for cosine values.

len

Number of elements in the vectors.

Description

This function computes sine of each element of pSrc and stores the result in the corresponding element of pDst1; computes cosine of each element of pSrc and stores the result in the corresponding element of pDst2.

For single precision data:

function flavor ippsSinCos_32f_A11 guarantees 11 correctly rounded bits of significand, or at least 3 exact decimal digits;

function flavor ippsSinCos_32f_A21 guarantees 21 correctly rounded bits of significand, or 4 ulps, or about 6 exact decimal digits;

function flavor ippsSinCos_32f_A24 guarantees 24 correctly rounded bits of significand, including the implied bit, with the maximum guaranteed error within 1 ulp.

For double precision data:

function flavor ippsSinCos_64f_A26 guarantees 26 correctly rounded bits of significand, or 6.7E+7 ulps, or approximately 8 exact decimal digits;

function flavor ippsSinCos_64f_A50 guarantees 50 correctly rounded bits of significand, or 4 ulps, or approximately 15 exact decimal digits;

function flavor ippsSinCos_64f_A53 guarantees 53 correctly rounded bits of significand, including the implied bit, with the maximum guaranteed error within 1 ulp.

The computation is performed as follows:

pDst1[n] = sin(pSrc[n]), pDst2[n] = cos(pSrc[n]), 0 ≤ n < len.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when pDst1 or pDst2 or pSrc pointer is NULL.

ippStsSizeErr

Indicates an error when len is less than or equal to 0.

IppStsDomain

In real functions, indicates a warning that the argument is out of the function domain, that is, at least one of the pSrc elements is equal to ± INF.

Example

The example below shows how to use the function ippsSinCos.

IppStatus ippsSinCos_32f_A21_sample(void) {
	const Ipp32f x[4] = {3857.845, -3939.024, -1468.856, -8592.486};
	Ipp32f y1[4];
	Ipp32f y2[4];
	IppStatus st = ippsSinCos_32f_A21( x, y1, y2, 4 );
	printf(" ippsSinCos_32f_A21:\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]);
	return st;
}

Output results:

 
ippsSinCos_32f_A21:
x  = 3857.845 -3939.024 -1468.856 -8592.486
y1 = -0.031 0.508 0.987 0.228
y2 = 1.000 0.861 0.161 -0.974