tan


tan

Calculates the tangent of an angle

 #include <math.h> double tan ( double x  ); float tanf ( float x  );         (C99) long double tanl ( long double x  );         (C99) 

The tan( ) function calculates the tangent of the angle represented by its argument x as a number of radians.

Example

 const double pi = 4.0L * atan( 1.0 );         // Because tan(pi/4) = 1 double shadow_length = 85.5,        angle = 36.2;          // Sun's elevation from the horizon, in                               // degrees double height = shadow_length * tan( angle * pi/180); printf("The tower is %.2f meters high.\n", height); 

This code produces the following output:

 The tower is 62.58 meters high. 

See Also

sin( ), cos( ), atan( ); the tangent functions for complex numbers, ctan( ), ctanf( ) and ctanl( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net