MathF.Sinh() Method in C# with Examples
Math.Sinh(Single) Method is the inbuilt MathF class method which returns the hyperbolic sine of a given single value argument.
Syntax: public static float Sinh (float x);
Here, x is the number whose hyperbolic sine is to be returned and type of this parameter is System.Single.
Return Value: This method returns the hyperbolic sine of x of type System.Single. If x is equal to NegativeInfinity or PositiveInfinity, PositiveInfinity is returned. If x is equal to NaN, NaN is returned.
Below programs illustrate the use of the above-discussed method:
Example 1:
Csharp
// C# program to illustrate the // MathF.Sinh(Single) Method using System; class GFG { // Main Method public static void Main(String[] args) { float num1 = 45.0f, num2 = 0.0f, num3 = 1.0f; // It returns the hyperbolic sine of // specified angle in radian float sinhvalue = MathF.Sinh(num1); Console.WriteLine("The Sinh of num1 = " + sinhvalue); sinhvalue = MathF.Sinh(num2); Console.WriteLine("The Sinh of num2 = " + sinhvalue); sinhvalue = MathF.Sinh(num3); Console.WriteLine("The Sinh of num3 = " + sinhvalue); } } |
Output:
The Sinh of num1 = 1.746714E+19 The Sinh of num2 = 0 The Sinh of num3 = 1.175201
Example 2:
Csharp
// C# program to illustrate the // MathF.Sinh(Single) Method using System; class GFG { // Main Method public static void Main() { float num1 = (60 * (MathF.PI)) / 180; // calling result() method result(num1); result(Single.NaN); result(Single.NegativeInfinity); result(Single.PositiveInfinity); } // defining result() method public static void result( float value) { // using the method float result = MathF.Sinh(value); // Display the value Console.WriteLine("Sinh({0}) will be {1}", value, result); } } |
Output:
Sinh(1.047198) will be 1.249367 Sinh(NaN) will be NaN Sinh(-Infinity) will be -Infinity Sinh(Infinity) will be Infinity
Contact Us