These are the familiar
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
approximation of pi. If strict ISO and/or POSIX compliance
are requested this constant is not defined, but you can easily define it
#define M_PI 3.14159265358979323846264338327
You can also compute the value of pi with the expression
— Function: float tanf (float x)
In many applications where
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 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,
*cosx, are in the range of
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 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.
ctanmay signal overflow if z is too close to a pole.