GNU Info

Info Node: (libc.info)Trig Functions

(libc.info)Trig Functions


Next: Inverse Trig Functions Prev: Mathematical Constants Up: Mathematics
Enter node , (file) or (file)node

Trigonometric Functions
=======================

   These are the familiar `sin', `cos', and `tan' functions.  The
arguments to all of these functions are in units of radians; recall
that pi radians equals 180 degrees.

   The math library normally defines `M_PI' to a `double' approximation
of pi.  If strict ISO and/or POSIX compliance are requested this
constant is not defined, but you can easily define it yourself:

     #define M_PI 3.14159265358979323846264338327

You can also compute the value of pi with the expression `acos (-1.0)'.

 - Function: double sin (double X)
 - Function: float sinf (float X)
 - Function: long double sinl (long double X)
     These functions return the sine of X, where X is given in radians.
     The return value is in the range `-1' to `1'.

 - Function: double cos (double X)
 - Function: float cosf (float X)
 - Function: long double cosl (long double X)
     These functions return the cosine of X, where X is given in
     radians.  The return value is in the range `-1' to `1'.

 - Function: double tan (double X)
 - Function: float tanf (float X)
 - Function: long double tanl (long double X)
     These functions return the tangent of X, where X is given in
     radians.

     Mathematically, the tangent function has singularities at odd
     multiples of pi/2.  If the argument X is too close to one of these
     singularities, `tan' will signal overflow.

   In many applications where `sin' and `cos' are used, the sine and
cosine of the same angle are needed at the same time.  It is more
efficient to compute them simultaneously, so the library provides a
function to do that.

 - Function: void sincos (double X, double *SINX, double *COSX)
 - Function: void sincosf (float X, float *SINX, float *COSX)
 - Function: void sincosl (long double X, long double *SINX, long
          double *COSX)
     These functions return the sine of X in `*SINX' and the cosine of
     X in `*COS', where X is given in radians.  Both values, `*SINX'
     and `*COSX', are in the range of `-1' to `1'.

     This function is a GNU extension.  Portable programs should be
     prepared to cope with its absence.

   ISO C99 defines variants of the trig functions which work on complex
numbers.  The GNU C library provides these functions, but they are only
useful if your compiler supports the new complex types defined by the
standard.  (As of this writing GCC supports complex numbers, but there
are bugs in the implementation.)

 - Function: complex double csin (complex double Z)
 - Function: complex float csinf (complex float Z)
 - Function: complex long double csinl (complex long double Z)
     These functions return the complex sine of Z.  The mathematical
     definition of the complex sine is

     sin (z) = 1/(2*i) * (exp (z*i) - exp (-z*i)).

 - Function: complex double ccos (complex double Z)
 - Function: complex float ccosf (complex float Z)
 - Function: complex long double ccosl (complex long double Z)
     These functions return the complex cosine of Z.  The mathematical
     definition of the complex cosine is

     cos (z) = 1/2 * (exp (z*i) + exp (-z*i))

 - Function: complex double ctan (complex double Z)
 - Function: complex float ctanf (complex float Z)
 - Function: complex long double ctanl (complex long double Z)
     These functions return the complex tangent of Z.  The mathematical
     definition of the complex tangent is

     tan (z) = -i * (exp (z*i) - exp (-z*i)) / (exp (z*i) + exp (-z*i))

     The complex tangent has poles at pi/2 + 2n, where n is an integer.
     `ctan' may signal overflow if Z is too close to a pole.


automatically generated by info2www version 1.2.2.9