Go to main content

man pages section 3: Extended Library Functions, Volume 4

Exit Print View

Updated: Thursday, June 13, 2019

acospi (3SUNMATH)


sinpi, sinpif, sinpil, cospi, cospif, cospil, tanpi, tanpif, tanpil, sincospi, sincospif, sincospil, asinpi, asinpif, asinpil, acospi, acospif, acospil, atanpi, atanpif, atanpil, atan2pi, atan2pif, atan2pil - trigonometric functions scaled by pi


cc [ flag ... ] file ...  -lsunmath -lm [ library ... ]
#include <sunmath.h>
double sinpi(double x);
float sinpif(float x);
long double sinpil(long double x);
double cospi(double x);
float cospif(float x);
long double cospil(long double x);
double tanpi(double x);
float tanpif(float x);
long double tanpil(long double x);
void sincospi(double x, double *s, double *c);
void sincospif(float x, float *s, float *c);
void  sincospil(long  double  x, long double *s, long double *c);
double asinpi(double x);
float asinpif(float x);
long double asinpil(long double x);
double acospi(double x);
float acospif(float x);
long double acospil(long double x);
double atanpi(double x);
float atanpif(float x);
long double atanpil(long double x);
double atan2pi(double y, double x);
float atan2pif(float y, float x);
long double atan2pil(long double y, long double x);


sinpi(x), cospi(x), and tanpi(x) compute trigonometric functions of angles measured in multiples of pi radians: sinpi(x) := sin(x * pi), and similarly for cospi(x) and tanpi(x). These functions are especially useful when the argument x is large, since the reduction to the primary range can be peformed exactly and very fast.

sincospi(x, s, c) simultaneously sets *s = sinpi(x) and *c = cospi(x).

The corresponding inverse functions compute asinpi(x) := asin(x) / pi, and similarly for acospi(x) and atanpi(x). Also, atan2pi(y, x) := atan2(y, x) / pi.


See attributes(7) for descriptions of the following attributes:

Interface Stability

See Also

asin(3M), acos(3M), atan(3M), atan2(3M), cos(3M), sin(3M), sincos(3M), sind(3SUNMATH), sinp(3SUNMATH), tan(3M), attributes(7)