tanh, tanhf, tanhl

Header: <math.h>

1-3) Computes the hyperbolic tangent of arg.

# Declarations

float tanhf( float arg );

(since C99)

double tanh( double arg );
long double tanhl( long double arg );

(since C99)

#define tanh( arg )

(since C99)

# Parameters

# Return value

If a range error occurs due to underflow, the correct result (after rounding) is returned.

# Notes

POSIX specifies that in case of underflow, arg is returned unmodified, and if that is not supported, an implementation-defined value no greater than DBL_MIN, FLT_MIN, and LDBL_MIN is returned.

# Example

#include <math.h>
#include <stdio.h>
 
int main(void)
{
    printf("tanh(1) = %f\ntanh(-1) = %f\n", tanh(1), tanh(-1));
    printf("tanh(0.1)*sinh(0.2)-cosh(0.2) = %f\n", tanh(0.1) * sinh(0.2) - cosh(0.2));
    // special values
    printf("tanh(+0) = %f\ntanh(-0) = %f\n", tanh(0.0), tanh(-0.0));
}

# See also