Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C |
both |
#include <math.h>
double tanh(double x);
float tanh(float x); /* C++ only */
long double tanh(long double x); /* C++ only */
float tanhf(float x);
long double tanhl(long double x);
Returns the calculated value of the hyperbolic tangent of x.
If the result underflows, the function returns 0 and sets the errno to ERANGE.
⁄* CELEBT02
This example computes x as the hyperbolic tangent of PI⁄4.
*⁄
#define _POSIX_SOURCE
#include <math.h>
#include <stdio.h>
int main(void)
{
double pi, x;
pi = 3.1415926;
x = tanh(pi⁄4);
printf("tanh( %lf ) = %lf\n", pi⁄4, x);
}
tanh( 0.785398 ) = 0.655794