December 2005
Beginner to intermediate
618 pages
20h 19m
English
tanh
Calculates the hyperbolic tangent of a number
#include <math.h> doubletanh( double x); floattanhf( float x); (C99) long doubletanhl( long double x); (C99)
The tanh() function returns
the hyperbolic tangent of its argument x,
which is defined as sinh(x)/cosh(x).
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.
Read now
Unlock full access