tanh


tanh

Calculates the hyperbolic tangent of a number

 #include <math.h> double tanh ( double x); float tanhf ( float x);         (C99) long double tanhl ( long double x);         (C99) 

The tanh( ) function returns the hyperbolic tangent of its argument x, which is defined as sinh(x)/cosh(x).

Example

 double x = -0.5, y1, y2; y1 = tanh(x); y2 = exp(2*x); y2 = (y2 -1) / (y2 + 1); printf("The tanh( ) function returns     %.15f.\n", y1 ); printf("Using the function exp( ) yields %.15f.\n", y2 ); 

This code produces the following output:

 The tanh( ) function returns     -0.462117157260010. Using the function exp( ) yields -0.462117157260010. 

See Also

sinh( ), cosh( ), atanh( ); the hyperbolic tangent and inverse tangent functions for complex numbers, ctanh( ) and catanh( )



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