asinh() function in C++ STL


The asinh() function returns the arc hyperbolic sine or the inverse hyperbolic sine of an angle given in radians. It is an inbuilt function in C++ STL.

The syntax of the asinh() function is given as follows.

asinh(var)

As can be seen from the syntax, the function asinh() accepts a parameter var of data type float, double or long double. The value of this parameter can be anything i.e negative, positive or 0. It returns the arc hyperbolic sine of var.

A program that demonstrates asinh() in C++ is given as follows −

Example

 Live Demo

#include <iostream>
#include <cmath>
using namespace std;
int main() {
   double d = -5, ans;
   ans = asinh(d);
   cout << "asinh("<< d <<") = " << ans << endl;
   return 0;
}

Output

asinh(-5) = -2.31244

In the above program, first the variable d is initialized. Then arc hyperbolic sine of d is found using asinh() and stored in ans. Finally the value of ans is displayed. This is demonstrated by the following code snippet.

double d = -5, ans;
ans = asinh(d);
cout << "asinh("<< d <<") = " << ans << endl;

The result obtained by using the asinh() function can be converted into degrees and displayed. A program to demonstrate this is as follows.

Example

 Live Demo

#include <iostream>
#include <cmath>
using namespace std;
int main() {
   double d = -5, ans;
   ans = asinh(d);
   ans = ans*180/3.14159;
   cout << "asinh("<< d <<") = " << ans << endl;
   return 0;
}

Output

asinh(-5) = -132.493

In the above program, the arc hyperbolic sine is obtained using asinh(). Then this value is converted into degrees. Finally, the output is displayed. This is demonstrated by the following code snippet.

double d = -5, ans;
ans = asinh(d);
ans = ans*180/3.14159;
cout << "asinh("<< d <<") = " << ans << endl;

Updated on: 24-Jun-2020

91 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements