# C# | Math.Tanh() Method

Math.Tanh() is the inbuilt Math class method which returns the hyperbolic tan of a given double value argument. The result will be NaN if the given argument is NaN.

Syntax:

`public static double Tanh(double num)`

Parameter:

num: It is the number whose hyperbolic tan is to be returned and type of this parameter is System.Double.

Return Value: The method returns the hyperbolic tan of num. of type System.Double. If num is equal to NegativeInfinity, this method returns -1. If num is equal to PositiveInfinity, this method returns 1. If num is equal to NaN, this method returns NaN.

Examples :

```Input  : num = 60.0
Output : 1.0
```

Below programs illustrate the Math.Tanh() method:

Program 1:

 `// C# program to illustrate the ` `// Math.Tanh() ` `using` `System; ` ` `  `class` `GFG { ` ` `  `    ``// Main Method ` `    ``public` `static` `void` `Main(String[] args) ` `    ``{ ` ` `  `        ``double` `num1 = 60.0, num2 = 0.0, num3 = 1.0; ` ` `  `        ``// It returns the hyperbolic tan of  ` `        ``// specified  angle in radian ` `        ``double` `tanhvalue = Math.Tanh(num1); ` `        ``Console.WriteLine(``"The tanh of num1 = "` `+ tanhvalue); ` ` `  `        ``tanhvalue = Math.Tanh(num2); ` `        ``Console.WriteLine(``"The tanh of num2 = "` `+ tanhvalue); ` ` `  `        ``tanhvalue = Math.Tanh(num3); ` `        ``Console.WriteLine(``"The tanh of num3 = "` `+ tanhvalue); ` `    ``} ` `} `

Output:

```The tanh of num1 = 1
The tanh of num2 = 0
The tanh of num3 = 0.761594155955765
```

Program 2:

 `// C# praogram to illustrate the ` `// Math.Tanh() Method ` `using` `System; ` ` `  `class` `GFG { ` `    `  `    ``// Main Method ` `    ``public` `static` `void` `Main(String[] args) ` `    ``{ ` ` `  `        ``double` `num1 = (30 * (Math.PI)) / 180, num2 = 11.0, num3 = 45.0; ` ` `  `        ``// It returns the hyperbolic tan of  ` `        ``// angle in radian ` `        ``double` `tanhvalue = Math.Tanh(num1); ` `        ``Console.WriteLine(``"The tanh of num1 = "` `+ tanhvalue); ` ` `  `        ``tanhvalue = Math.Tanh(num2); ` `        ``Console.WriteLine(``"The tanh of num2 = "` `+ tanhvalue); ` ` `  `        ``tanhvalue = Math.Tanh(num3); ` `        ``Console.WriteLine(``"The tanh of num3 = "` `+ tanhvalue); ` `    ``} ` `} `

Output:

```The tanh of num1 = 0.480472778156452
The tanh of num2 = 0.999999999442106
The tanh of num3 = 1
```

My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.