Intel® oneAPI Math Kernel Library Developer Reference - C

v?SinCos

Computes sine and cosine of vector elements.

Syntax

vsSinCos( n, a, y, z );

vsSinCosI(n, a, inca, y, incy, z, incz);

vmsSinCos( n, a, y, z, mode );

vmsSinCosI(n, a, inca, y, incy, z, incz, mode);

vdSinCos( n, a, y, z );

vdSinCosI(n, a, inca, y, incy, z, incz);

vmdSinCos( n, a, y, z, mode );

vmdSinCosI(n, a, inca, y, incy, z, incz, mode);

Include Files

Input Parameters

Name

Type

Description

n

const MKL_INT

Specifies the number of elements to be calculated.

a

const float* for vsSinCos, vmsSinCos

const double* for vdSinCos, vmdSinCos

Pointer to an array that contains the input vector a.

inca, incy, incz

const MKL_INT

Specifies increments for the elements of a, y, and z.

mode

const MKL_INT64

Overrides global VM mode setting for this function call. See vmlSetMode for possible values and their description.

Output Parameters

Name

Type

Description

y, z

float* for vsSinCos, vmsSinCos

double* for vdSinCos, vmdSinCos

Pointers to arrays that contain the output vectors y (for sinevalues) and z(for cosine values).

Description

The function computes sine and cosine of vector elements.

Note that arguments abs(a[i]) ≤ 213 and abs(a[i]) ≤ 216 for single and double precisions respectively are called fast computational path. These are trigonometric function arguments for which VM provides the best possible performance. Avoid arguments that do not belong to the fast computational path in the VM High Accuracy (HA) and Low Accuracy (LA) functions. Alternatively, you can use VM Enhanced Performance (EP) functions that are fast on the entire function domain. However, these functions provide less accuracy.

Special Values for Real Function v?SinCos(x)
Argument Result 1 Result 2 VM Error Status Exception
+0 +0 +1    
-0 -0 +1    
+ QNAN QNAN VML_STATUS_ERRDOM INVALID
- QNAN QNAN VML_STATUS_ERRDOM INVALID
QNAN QNAN QNAN    
SNAN QNAN QNAN   INVALID

Specifications for special values of the complex functions are defined according to the following formula

Sin(z) = -i*Sinh(i*z).

Optimization Notice

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804

This notice covers the following instruction sets: SSE2, SSE4.2, AVX2, AVX-512.