Go to main content

man pages section 3: Extended Library Functions, Volume 4

Exit Print View

Updated: Thursday, June 13, 2019

tanpl (3SUNMATH)


sinp, sinpf, sinpl, cosp, cospf, cospl, tanp, tanpf, tanpl, sincosp, sincospf, sincospl, asinp, asinpf, asinpl, acosp, acospf, acospl, atanp, atanpf, atanpl - trigonometric functions with floating-point period


cc [ flag ... ] file ...  -lsunmath -lm [ library ... ]
#include <sunmath.h>
double sinp(double x);
float sinpf(float x);
long double sinpl(long double x);
double cosp(double x);
float cospf(float x);
long double cospl(long double x);
double tanp(double x);
float tanpf(float x);
long double tanpl(long double x);
void sincosp(double x, double *s, double *c);
void sincospf(float x, float *s, float *c);
void  sincospl(long  double  x,  long double *s, long double *c);
double asinp(double x);
float asinpf(float x);
long double asinpl(long double x);
double acosp(double x);
float acospf(float x);
long double acospl(long double x);
double atanp(double x);
float atanpf(float x);
long double atanpl(long double x);


sinp(x), cosp(x), and tanp(x) compute trigonometric functions scaled to have period 2*PI, where PI is the best floating-point approximation to pi: sinp(x) := sin(x * pi/PI), and similarly for cosp(x) and tanp(x). The double functions sinp, cosp, and tanp use the best double precision approximation to pi. The float functions sinpf, cospf, and tanpf use the best single precision approximation to pi. The long double functions sinpl, cospl, and tanpl use the best quadruple precision approximation on SPARC and the best extended double precision approximation on x86. For large arguments, these functions may be faster than the standard trigonometric functions with period 2pi, but they are not as fast as the trigonometric functions scaled by pi described in sinpi(3SUNMATH).

sincosp(x, s, c) simultaneously sets *s = sinp(x) and *c = cosp(x).

The corresponding inverse functions ostensibly compute asinp(x) := asin(x) * PI/pi, and similarly for acosp(x) and atanp(x), but since PI/pi is within a unit in the last place of 1, these functions actually just return the unscaled values asin(x), acos(x), and atan(x), respectively.


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

Interface Stability

See Also

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