Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

tan, tanf, tanl - Tangent

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double tan(double x);
float tanf(float x); (C11)
long double tanl(long double x); (C11)

Tese functions calculate the trigonometric function tangent within the permissible range of floatingpoint numbers. x specifies the angle in radians.

Returnwert

tan(x)

for any valid floating-point number x.


+/-HUGE_VAL
+/-HUGE_VALF
+/-HUGE_VALL

depending on the function type and the sign of x, if an overflow occurs. In addition, errno is set to ERANGE (result too
large).

Example

The following program outputs the tangent of an input number.

#include <math.h>
#include <stdio.h>
int main(void)
{
     double x;
     printf("Please enter a number :\n");
     scanf("%lf", &x);
     printf("The tangent of %g is %g \n", x, tan(x));
     return 0;
}

See also

sin, cos, tanh, atan