- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Math.Tanh() Method in C#
The Math.Tanh() method in C# is used to return the hyperbolic tangent of the specified angle.
Syntax
public static double Tanh (double val);
Above, Val is the angle.
Example
Let us now see an example to implement Math.Tanh() method −
using System; public class Demo { public static void Main(){ double val1 = 30.0; double val2 = (60 * (Math.PI)) / 180; Console.WriteLine(Math.Tanh(val1)); Console.WriteLine(Math.Tanh(val2)); } }
Output
This will produce the following output −
1 0.780714435359268
Example
Let us see another example to implement Math.Tanh() method −
using System; public class Demo { public static void Main(){ double val1 = 0.0; double val2 = 1.0; double val3 = 15.0; Console.WriteLine(Math.Tanh(val1)); Console.WriteLine(Math.Tanh(val2)); Console.WriteLine(Math.Tanh(val3)); } }
Output
This will produce the following output −
0 0.761594155955765 0.999999999999813
Advertisements