Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
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

Trigonometric Functions

Many routines in the Intel® oneAPI DPC++/C++ Compiler Math Library are more optimized for Intel® microprocessors than for non-Intel microprocessors.

The mathimf.h header file includes prototypes for Intel® oneAPI DPC++/C++ Compiler Math Library functions.

The math library supports the following trigonometric functions:

NOTE:

FP16 Math Functions have the following requirements:

  • Version 2021.4 or higher of the Intel® oneAPI DPC++/C++ Compiler.

  • A next-generation Intel® Xeon® Scalable processor, code name Sapphire Rapids.

acos

Description: The acos function returns the principal value of the inverse cosine of x in the range [0, pi] radians for x in the interval [-1,1].

errno: EDOM, for |x| > 1

Calling interface:
double acos(double x);
long double acosl(long double x);
float acosf(float x);
_Float16 acosf16(_Float16 x);

acosd

Description: The acosd function returns the principal value of the inverse cosine of x in the range [0,180] degrees for x in the interval [-1,1].

errno: EDOM, for |x| > 1

Calling interface:
double acosd(double x);
long double acosdl(long double x);
float acosdf(float x);
_Float16 acosdf16(_Float16 x);

acospi

Description: The acospi function returns the principal value of the inverse cosine of x, divided by pi, in the range [0,1] for x in the interval [-1,1].

errno: EDOM, for |x| > 1

Calling interface:
double acospi(double x);
float acospif(float x);
_Float16 acospif16(_Float16 x);

asin

Description: The asin function returns the principal value of the inverse sine of x in the range [-pi/2, +pi/2] radians for x in the interval [-1,1].

errno: EDOM, for |x| > 1

Calling interface:
double asin(double x);
long double asinl(long double x);
float asinf(float x);
_Float16 asinf16(_Float16 x);

asind

Description: The asind function returns the principal value of the inverse sine of x in the range [-90,90] degrees for x in the interval [-1,1].

errno: EDOM, for |x| > 1

Calling interface:
double asind(double x);
long double asindl(long double x);
float asindf(float x);
_Float16 asindf16(_Float16 x);

asinpi

Description: The asinpi function returns the principal value of the inverse sine of x, divided by pi, in the range [-1/2,1/2] degrees for x in the interval [-1,1].

errno: EDOM, for |x| > 1 divided by pi

Calling interface:
double asinpi(double x);
float asinpif(float x);
_Float16 asinpif16(_Float16 x);

atan

Description: The atan function returns the principal value of the inverse tangent of x in the range [-pi/2, +pi/2] radians.

Calling interface:
double atan(double x);
long double atanl(long double x);
float atanf(float x);
_Float16 atanf16(_Float16 x);

atan2

Description: The atan2 function returns the principal value of the inverse tangent of y/x in the range [-pi, +pi] radians.

errno: EDOM, for x = 0 and y = 0

Calling interface:
double atan2(double y, double x);
long double atan2l(long double y, long double x);
float atan2f(float y, float x);
_Float16 atan2f16(_Float16 y, _Float16 x);

atan2pi

Description: The atan2pi function returns the principal value of the inverse tangent of y/x, divided by pi, in the range [-1, +1].

errno: EDOM, for x = 0 and y = 0

Calling interface:
double atan2pi(double y, double x);
float atan2pif(float y, float x);
_Float16 atan2pif16(_Float16 y, _Float16 x);

atand

Description: The atand function returns the principal value of the inverse tangent of x in the range [-90,90] degrees.

Calling interface:
double atand(double x);
long double atandl(long double x);
float atandf(float x);
_Float16 atandf16(_Float16 x);

atan2d

Description: The atan2d function returns the principal value of the inverse tangent of y/x in the range [-180, +180] degrees.

errno: EDOM, for x = 0 and y = 0.

Calling interface:
double atan2d(double x, double y);
long double atan2dl(long double x, long double y);
float atan2df(float x, float y);
_Float16 atan2df16(_Float16 x, _Float16 y);

atand2

Description: The atand2 function returns the principal value of the inverse tangent of y/x in the range [-180, +180] degrees.

errno: EDOM, for x = 0 and y = 0.

Calling interface:
double atand2(double x, double y);
long double atand2l(long double x, long double y);
float atand2f(float x, float y);
_Float16 atand2f16(_Float16 x, _Float16 y);

atanpi

Description: The atanpi function returns the principal value of the inverse tangent of x, divided by pi, in the range [-1/2, +1/2].

Calling interface:
double atanpi(double x);
float atanpif(float x);
_Float16 atanpif16(_Float16 x);

cos

Description: The cos function returns the cosine of x measured in radians.

Calling interface:
double cos(double x);
long double cosl(long double x);
float cosf(float x);
_Float16 float cosf16(_Float16 x);

cosd

Description: The cosd function returns the cosine of x measured in degrees.

Calling interface:
double cosd(double x);
long double cosdl(long double x);
float cosdf(float x);
_Float16 cosdf16(_Float16 x);

cospi

Description: The cospi function returns the cosine of x multiplied by pi, cos(x*pi).

Calling interface:
double cospi(double x);
float cospif(float x);
_Float16 cospif16(_Float16);

cot

Description: The cot function returns the cotangent of x measured in radians.

errno: ERANGE, for overflow conditions at x = 0.

Calling interface:
double cot(double x);
long double cotl(long double x);
float cotf(float x);
_Float16 cotf16(_Float16 x);

cotd

Description: The cotd function returns the cotangent of x measured in degrees.

errno: ERANGE, for overflow conditions at x = 0.

Calling interface:
double cotd(double x);
long double cotdl(long double x);
float cotdf(float x);
_Float16 cotdf16(_Float16 x);

sin

Description: The sin function returns the sine of x measured in radians.

Calling interface:
double sin(double x);
long double sinl(long double x);
float sinf(float x);
_Float16 sinf16(_Float16 x);

sincos

Description: The sincos function returns both the sine and cosine of x measured in radians.

Calling interface:
void sincos(double x, double *sinval, double *cosval);
void sincosl(long double x, long double *sinval, long double *cosval);
void sincosf(float x, float *sinval, float *cosval);
void sincosf16(_Float16 x, _Float16 *sinval, _Float16 *cosval);

sincosd

Description: The sincosd function returns both the sine and cosine of x measured in degrees.

Calling interface:
void sincosd(double x, double *sinval, double *cosval);
void sincosdl(long double x, long double *sinval, long double *cosval);
void sincosdf(float x, float *sinval, float *cosval);
void sincosdf16(_Float16 x, _Float16 *sinval, _Float16 *cosval);

sind

Description: The sind function computes the sine of x measured in degrees.

Calling interface:
double sind(double x);
long double sindl(long double x);
float sindf(float x);
_Float16 sindf16((_Float16 x);

sinpi

Description: The sinpi function returns the sine of x multiplied by pi, sin(x*pi).

Calling interface:
double sinpi(double x);
float sinpif(float x);
_Float16 sinpif16(_Float16 x);

tan

Description: The tan function returns the tangent of x measured in radians.

Calling interface:
double tan(double x);
long double tanl(long double x);
float tanf(float x);
_Float16 tanf16(_Float16 x);

tand

Description: The tand function returns the tangent of x measured in degrees.

errno: ERANGE, for overflow conditions

Calling interface:
double tand(double x);
long double tandl(long double x);
float tandf(float x);
_Float16 tandf16(_Float16 x);

tanpi

Description: The tanpi function returns the tangent of x multiplied by pi, tan(x*pi).

Calling interface:
double tanpi(double x);
float tanpif(float x);
_Float16 tanpif16(_Float16 x);