Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
MathF.Asinh() Method in C# with Examples
The MathF.Asinh() method in C# returns the inverse hyperbolic sine (arc hyperbolic sine) of a specified single-precision floating-point number. This method is part of the System namespace and is commonly used in mathematical calculations involving hyperbolic functions.
The inverse hyperbolic sine function is the inverse of the hyperbolic sine function. For any real number x, Asinh(x) returns the value y such that sinh(y) = x.
Syntax
Following is the syntax for the MathF.Asinh() method −
public static float Asinh(float val);
Parameters
- val − A single-precision floating-point number representing the hyperbolic sine value for which to find the inverse.
Return Value
The method returns a float value representing the hyperbolic arc-sine of the input parameter. The return value is in radians and ranges from negative infinity to positive infinity.
Special cases include −
- If
valisNaN, the method returnsNaN. - If
valis positive infinity, the method returns positive infinity. - If
valis negative infinity, the method returns negative infinity. - If
valis 0, the method returns 0.
Using MathF.Asinh() with Positive Values
Example
using System;
public class Demo {
public static void Main() {
float val1 = 1.2f;
float val2 = 45.5f;
Console.WriteLine("Asinh(" + val1 + ") = " + MathF.Asinh(val1));
Console.WriteLine("Asinh(" + val2 + ") = " + MathF.Asinh(val2));
}
}
The output of the above code is −
Asinh(1.2) = 1.015973 Asinh(45.5) = 4.51098
Using MathF.Asinh() with Various Values
Example
using System;
public class Demo {
public static void Main() {
float val1 = 0.1f;
float val2 = -2.5f;
float val3 = 0.0f;
Console.WriteLine("Asinh(" + val1 + ") = " + MathF.Asinh(val1));
Console.WriteLine("Asinh(" + val2 + ") = " + MathF.Asinh(val2));
Console.WriteLine("Asinh(" + val3 + ") = " + MathF.Asinh(val3));
}
}
The output of the above code is −
Asinh(0.1) = 0.09983408 Asinh(-2.5) = -1.647231 Asinh(0) = 0
Using MathF.Asinh() with Special Values
Example
using System;
public class Demo {
public static void Main() {
float positiveInfinity = float.PositiveInfinity;
float negativeInfinity = float.NegativeInfinity;
float nanValue = float.NaN;
Console.WriteLine("Asinh(+?) = " + MathF.Asinh(positiveInfinity));
Console.WriteLine("Asinh(-?) = " + MathF.Asinh(negativeInfinity));
Console.WriteLine("Asinh(NaN) = " + MathF.Asinh(nanValue));
}
}
The output of the above code is −
Asinh(+?) = ? Asinh(-?) = -? Asinh(NaN) = NaN
Conclusion
The MathF.Asinh() method calculates the inverse hyperbolic sine of a single-precision floating-point number. It handles all real numbers and special values like infinity and NaN appropriately, making it useful for advanced mathematical computations involving hyperbolic functions.
