VF_sincosVD_sincosVE_sincos
VFx_sincosVDx_sincosVEx_sincos
VFr_sincosVDr_sincosVEr_sincos
VFrx_sincosVDrx_sincosVErx_sincos
FunctionSine and Cosine simultaneously
Syntax C/C++#include <VFmath.h>
int VF_sincos( fVector YSin, fVector YCos, fVector X, ui size );
int VFx_sincos( fVector YSin, fVector YCos, fVector X, ui size, float A, float B, float C );
int VFr_sincos( fVector YSin, fVector YCos, fVector X, ui size );
int VFrx_sincos( fVector YSin, fVector YCos, fVector X, ui size, float A, float B, float C );
C++ VecObj#include <OptiVec.h>
int vector<T>::sincos( vector<T> YCos, const vector<T>& X );
int vector<T>::x_sincos( vector<T> YCos, const vector<T>& X, const T& A, const T& B, const T& C );
int vector<T>::r_sincos( vector<T> YCos, const vector<T>& X );
int vector<T>::rx_sincos( vector<T> YCos, const vector<T>& X, const T& A, const T& B, const T& C );
Pascal/Delphiuses VFmath;
function VF_sincos( Sin, Cos, X:fVector; size:UIntSize ): IntBool;
function VFx_sincos( Sin, Cos, X:fVector; size:UIntSize; A, B, C:Single ): IntBool;
function VFr_sincos( Sin, Cos, X:fVector; size:UIntSize ): IntBool;
function VFrx_sincos( Sin, Cos, X:fVector; size:UIntSize; A, B, C:Single ): IntBool;
CUDA function C/C++#include <cudaVFmath.h>
int cudaVF_sincos( fVector d_YSin, fVector d_YCos, fVector d_X, ui size );
int cudaVFx_sincos( fVector d_YSin, fVector d_YCos, fVector d_X, ui size, float A, float B, float C );
int cusdVFx_sincos( fVector d_YSin, fVector d_YCos, fVector d_X, ui size, float *d_A, float *d_B, float *d_C );
int VFcu_sincos( fVector h_YSin, fVector h_YCos, fVector h_X, ui size );
int VFxcu_sincos( fVector h_YSin, fVector h_YCos, fVector h_X, ui size, float A, float B, float C );
CUDA function Pascal/Delphiuses VFmath;
function cudaVF_sincos( d_YSin, d_YCos, d_X:fVector; size:UIntSize ): IntBool;
function cudaVFx_sincos( d_YSin, d_YCos, d_X:fVector; size:UIntSize; A, B, C:Single ): IntBool;
function cusdVFx_sincos( d_YSin, d_YCos, d_X:fVector; size:UIntSize; d_A, d_B, d_C:PSingle ): IntBool;
function VFcu_sincos( h_YSin, h_YCos, h_X:fVector; size:UIntSize ): IntBool;
function VFxcu_sincos( h_YSin, h_YCos, h_X:fVector; size:UIntSize; A, B, C:Single ): IntBool;
Descriptionsimple versions:
YSini = sin( Xi )
YCosi = cos( Xi )
expanded versions:
YSini = C * sin( A*Xi+B )
YCosi = C * cos( A*Xi+B )
The sine and the cosine are calculated simultaneously, which is far more efficient than calculating them separately if both of them are needed.

For large values of Xi, round-off error becomes larger and larger; if the Xi values are representable as fractional multiples of p, it is better to use VF_sincosrpi than VF_sincos.

If, on the other hand, one can be sure that all Xi are within a reasonable range one can employ the faster reduced-range versions with the prefixes VFr_ and VFrx_. The range requirements for the reduced-range versions are:
64-bit: |Xi| < 232 (roughly 4.2*109)
32-bit: |Xi| ≤ 2p).
The reduced-range versions are not available for CUDA.

Error handlingPrecision errors lead to a result of 0.0 for the sine and 1.0 for the cosine (as if the input were 0.0) along with a non-zero return value, but are otherwise ignored; _matherr is not called. Other errors should not occur.
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero).
See alsoVF_sincos2,   VF_sincosrpi,   sin,   cos

VectorLib Table of Contents  OptiVec home