IMF Device Library Trigonometric Functions

The IMF Device Library supports the following trigonometric and inverse trigonometric functions:

acos

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

Special Values:

Argument x Result acos(x)
-1
+/-0 +π/2
+1 +0
|x| > 1 QNAN
+/-∞ QNAN

Useful Identities:

acos(x) = asin( sqrt(1 - x^2) ), 0 <= x <= 1
acos(x) = atan( sqrt(1 - x^2) / x )

Calling Interfaces:

asin

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

Special Values:

Argument x Result asin(x)
-1 -π/2
+/-0 +/-0
+1 +π/2
|x| > 1 QNAN
+/-∞ QNAN

Useful Identities:

asin(x) = 0.5 · acos( 1 - 2·x^2 ), 0 <= x <= 1
asin(x) = atan( x / sqrt(1 - x^2) )

Calling Interfaces

atan

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

Special Values:

Argument x Result atan(x)
+/-0 +/-0
+/-∞ +/-π/2

Useful Identities:

atan(x) = asin( x / sqrt(1 + x^2) )
atan(x) = acos(sqrt (1 / (1 + x^2))) , x >= 0

Calling Interfaces:

atan2

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

Special Values:

Argument y Argument x Result atan2(y,x)
-∞ -∞ -3*π/2
-∞ x < +0 -π/2
-∞ -0 -π/2
-∞ +0 -π/2
-∞ x > +0 -π/2
-∞ +∞ -π/4
y < +0 -∞
y < +0 -0 -π/2
y < +0 +0 -π/2
y < +0 +∞ -0
-0 -∞
-0 x < +0
-0 -0
-0 +0 -0
-0 x > +0 -0
-0 +∞ -0
+0 -∞
+0 x < +0
+0 -0
+0 +0 +0
+0 x > +0 +0
+0 +∞ +0
y > +0 -∞
y > +0 -0 +π/2
y > +0 +0 +π/2
y > +0 +∞ +0
+∞ -∞ +3*π/4
+∞ x < +0 +π/2
+∞ -0 +π/2
+∞ +0 +π/2
+∞ x > +0 +π/2
+∞ +∞ +π/4
any y S/QNAN QNAN
S/QNAN any x QNAN

Calling Interfaces

cos

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

Special Values:

Argument x Result cos(x)
+/-0 +1
+/-∞ QNAN

Calling Interfaces

cospi

Description: The cospi(x) function returns the cosine of x multiplied by π: cos(x·π).

Special Values:

Argument x Result cospi(x)
+/-0 +1
n + 0.5 +0
+/-∞ QNAN

Note

n is any integer number where n + 0.5 is representable.

Useful Identities

cospi(x) = cos(x·PI)

Calling Interfaces

Default accuracy:

float       sycl::ext::intel::math::cospi ( float x );
double      sycl::ext::intel::math::cospi ( double x );

sin

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

Special Values:

Argument x Result sin(x)
+/-0 +/-0
+/-∞ QNAN

Calling Interfaces

sincos

Description: The sincos(x, &s, &c) function returns the sine and cosine of x measured in radians: s=sin(x), c=cos(x).

Special Values:

Argument x Result s=sin(x) Result c=cos(x)
+/-0 +/-0 +1
+/-∞ QNAN QNAN

Calling Interfaces

sincospi

Description: The sincospi(x, &s, &c) function returns the sine and cosine of x multiplied by π: s=sin(x·π), c=cos(x·π).

Special Values:

Argument x Result s=sinpi(x) Result c=cospi(x)
+/-0 +/-0 +1
+/-n (n is any integer number) +/-0 cospi(x)
n + 0.5 (n is any integer number where n + 0.5 is representable) sinpi(x) +0
+/-∞ QNAN QNAN

Calling Interfaces

Default accuracy:

float       sycl::ext::intel::math::sincospi ( float x, float* s, float* c );
double      sycl::ext::intel::math::sincospi ( double x, double* s, double* c );

sinpi

Description: The sinpi(x) function returns the sine of x multiplied by π: sin(x·π).

Special Values:

Argument x Result sinpi(x)
+/-0 +/-0
+/-n* +/-0
+/-∞ QNAN

Useful Identities:

sinpi(x) = sin(x·PI)

Calling Interfaces

Default accuracy:

float       sycl::ext::intel::math::sinpi ( float x );
double      sycl::ext::intel::math::sinpi ( double x );

tan

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

Special Values:

Argument x Result tan(x)
+/-0 +/-0
+/-∞ QNAN

Useful Identities

tan(x) = sin(x) / cos(x)

Calling Interfaces