In this C++ tutorial, you will learn how to find the inverse hyperbolic sine of a given number using asinh() function of cmath, with syntax and examples.
C++ asinh()
C++ asinh() returns arc (inverse) hyperbolic sine of a given number in radians.
Syntax
The syntax of C++ asinh() is
asinh(x)
where
Parameter | Description |
---|---|
x | A double, float, or long double value. |
Returns
The return value depends on the type of value passed for parameter x.
The return value of asinh(x) is
- double if x is double.
- float if x is float.
- long double if x is long double.
The synopsis of asinh() function is
double asinh(double x);
float asinh(float x);
long double asinh(long double x);
double asinh(T x); // For integral type
asinh() is a function of cmath library. Include cmath library at start of the program, if using asinh() function.
Example
In this example, we read a value from user into x, and find its inverse hyperbolic sine value using asinh() function.
C++ Program
#include <iostream>
#include<cmath>
using namespace std;
int main() {
double x;
cout << "Enter a number : ";
cin >> x;
double result = asinh(x);
cout << "asinh(" << x << ") : " << result << " radians" << endl;
}
Output
Enter a number : 25
asinh(25) : 3.91242 radians
Program ended with exit code: 0
Enter a number : 0
asinh(0) : 0 radians
Program ended with exit code: 0
Enter a number : -65
asinh(-65) : -4.86759 radians
Program ended with exit code: 0
Conclusion
In this C++ Tutorial, we learned the syntax of C++ asinh(), and how to use this function to find the inverse hyperbolic sine of given value, with the help of examples.