


TRIG(3M)              MATHEMATICAL LIBRARY               TRIG(3M)



NAME
     sin, cos, tan, asin, acos, atan, atan2 - trigonometric func-
     tions

SYNOPSIS
     #include <math.h>

     double sin(x)
     double x;

     double cos(x)
     double x;

     void sincos(x, s, c)
     double x, *s, *c;

     double tan(x)
     double x;

     double asin(x)
     double x;

     double acos(x)
     double x;

     double atan(x)
     double x;

     double atan2(y, x)
     double y, x;

     double sinpi(x)
     double x;

     double cospi(x)
     double x;

     void sincospi(x, s, c)
     double x, *s, *c;

     double tanpi(x)
     double x;

     double asinpi(x)
     double x;

     double acospi(x)
     double x;

     double atanpi(x)
     double x;




Sun Release 4.1    Last change: 28 March 1988                   1






TRIG(3M)              MATHEMATICAL LIBRARY               TRIG(3M)



     double atan2pi(y, x)
     double y, x;

DESCRIPTION
     sin(), cos(), sincos(), and tan() return trigonometric func-
     tions  of  radian  arguments.   The  values of trigonometric
     functions  of  arguments  exceeding  p/4  in  magnitude  are
     affected  by  the precision of the approximation to p/2 used
     to reduce those arguments to the range -p/4 to  p/4.   Argu-
     ment  reduction  may  occur  in  hardware or software; if in
     software, the variable  fp_pi  defined  in  <math.h>  allows
     changing that precision at run time.  Trigonometric argument
     reduction is discussed in  the  _F_l_o_a_t_i_n_g-_P_o_i_n_t  _P_r_o_g_r_a_m_m_e_r'_s
     _G_u_i_d_e.   Note: sincos(x,s,c) allows simultaneous computation
     of *s = sin(x) and *c = cos(x).

     asin() returns the arc sin in the range -p/2 to p/2.

     acos() returns the arc cosine in the range 0 to p.

     atan() returns the arc tangent of _x in  the  range  -p/2  to
     p/2.

     atan2(_y,_x) and hypot(x,y) (see hypot(3M)) convert  rectangu-
     lar  coordinates (_x,_y) to polar (_r,_t_h); atan2() computes _t_h,
     the argument or phase, by computing an arc tangent of _y/_x in
     the  range -p to p.  atan2(0.0,0.0) is +-0.0 or +-p, in con-
     formance with 4.3BSD, as  discussed  in  the  _F_l_o_a_t_i_n_g-_P_o_i_n_t
     _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e.

     sinpi(), cospi(), and tanpi() avoid  range-reduction  issues
     because  their  definition  sinpi(x)==sin(p*x) permits range
     reduction that is fast and exact for all _x.  The correspond-
     ing  inverse  functions compute asinpi(x)==asin(x)/p.  Simi-
     larly atan2pi(y,x)==atan2(y,x)/p.

DIAGNOSTICS
     These functions handle exceptional arguments in  the  spirit
     of ANSI/IEEE Std 754-1985.  sin(+-oo), cos(+-oo), tan(+-oo),
     or asin(_x) or acos(_x) with |_x|>1, return NaN;  sinpi(_x)  et.
     al.  are  similar.  In addition, asin(), acos(), and atan2()
     may also set errno and call matherr(3M).

SEE ALSO
     hypot(3M), matherr(3M)










Sun Release 4.1    Last change: 28 March 1988                   2



