Anonymous contributor
Anonymous contributor
Published Apr 10, 2023
Contribute to Docs

The Math.Tanh() method returns the hyperbolic tangent of a given angle in radians.



This method accepts a single parameter,x, which is the angle in radians. It returns the hyperbolic tangent value of x.


The example below declares two double values, x and y, and then calculates the hyperbolic tangent of x using the Math.Tanh() function. The resulting value is stored in y. Finally, the value of y is printed to the console.

using System;
public class Program
public static void Main()
double x = 2;
double y = Math.Tanh(x);
// Output: 0.9640275800758169

All contributors

Looking to contribute?

Learn C# on Codecademy