CosOne

Computes the cosine of an angle.

Syntax

Intel IPP style:

IppStatus ippsqCosOne_32f(const Ipp32f* pX, Ipp32f* pCos);

IppStatus ippsqCosOneQ15_16s(const Ipp16s* pX, Ipp16s* pCos);

IppStatus ippsqCosOneQ31_32s(const Ipp32s* pX, Ipp32s* pCos);

DSP style:

float32_t ippsq_cos_f32(const float32_t X);

q15_t ippsq_cos_q15(const q15_t X);

q31_t ippsq_cos_q31(const q31_t X);

Include Files

ippsq.h

dsp.h

Parameters

pX

Pointer to the source value (for Intel IPP style).

X

Source value (for DSP style).

pCos

Pointer to the result (for Intel IPP style).

Description

This function computes the cosine of the pX value and stores the result in pCos. In floating point flavors, the input value X is in radians. The Q15 and Q31 flavors support the source value in radians scaled in range [-1, +1), which is mapped to [-2pi, 2pi).

The following table lists functions' arguments and return values:

Degrees 60° 90° 180° 360°
F32 src 0 PI/3 PI/2 PI 2*PI
F32 cos 1 0.5 0 -1 1
Q15 src 0 0x1555 0x2000 0x4000 0x7fff
Q15 cos 0x7fff 0x3fff 0 0x8001 0x7fff
Q31 src 0 0x15555555 0x20000000 0x40000000 0x7fffffff
Q31 cos 0x7fffffff 0x40000000 0 0x80000000 0x7ffffffc

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.

DSP-style APIs return the resulting value.

For more complete information about compiler optimizations, see our Optimization Notice.