

#include <math.h> double tan(double x);
tan computes the trigonometric tangent of an argument x expressed
in radians.
Because the tangent function is periodic, only the value of x mod 2 pi is used
to compute the tangent. If x is very large, only a limited precision is
left to represent x mod 2 pi. Thus, an error message is written for very large
negative or positive arguments (see DIAGNOSTICS).
tan returns the value of the tangent of the argument x,
provided that this value is defined and computable. The return value is a
double-precision, floating-point number.
x is +- pi/2, +-3pi/2,
or any other value of the following form:
pi/2 + n(pi)n is an integer.
If the value of x is so close to an odd multiple of pi/2 that the
tangent cannot be represented accurately, the function returns HUGE_VAL.
The run-time library writes an error message to stderr (the standard
error file).
If the value of x is greater than 6.7465e9, the function returns 0.0. In
this case, the message "total loss of significance" is also written to
stderr.
If an error occurs in tan, the _matherr routine is called.
You can supply your own version of _matherr to suppress the diagnostic
message or modify the value returned.
#include <stdio.h>
#include <math.h>
#define YVAL 1.04
main()
{
double cotan;
/* The cotangent is 1 divided by the */
/* tangent of YVAL. */
cotan = 1 / tan(YVAL);
printf("1 / tan(%f) = %fn", YVAL, cotan);
}
cos, _matherr, sin
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.