English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C Language Basic Tutorial

C Language Flow Control

C Language Functions

C Language Arrays

C Language Pointers

C Language Strings

C Language Structure

C Language File

C Others

C Language Reference Manual

Usage and Example of C Library Function tanh()

C Standard Library - <math.h>

C Library Function double tanh(double x) Returns x hyperbolic tangent value.

Declaration

Below is the declaration of the tanh() function.

double tanh(double x)

Parameter

  • x  -- Floating-point value.

Return Value

This function returns the hyperbolic tangent of x.

Online Example

The following example demonstrates the usage of the tanh() function.

#include <stdio.h>
#include <math.h>
int main()
{
    double x, ret;
    x = 0.87;
    ret = tanh(x);
    printf("%lf's hyperbolic tangent is %lf degrees", x, ret);
    return(0);
}

Let's compile and run the above program, which will produce the following results:

0.87The hyperbolic tangent of 0.0000 is 0.701374

C Standard Library - <math.h>