In this C++ tutorial, you will learn how to find the hyperbolic sine of an angle using sinh() function of cmath, with syntax and examples.

C++ sinh()

C++ sinh() returns hyperbolic sine of an angle given in radians.

Syntax

The syntax of C++ sinh() is

sinh(x)

where

ParameterDescription
xA double, float, long double, or integral type value representing angle in radians.

Returns

The return value depends on the type of value passed for parameter x.

The return value of sinh(x) is

  • double if x is double or integral type.
  • float if x is float.
  • long double if x is long double.

The synopsis of sinh() function is

double sinh(double x);
float sinh(float x);
long double sinh(long double x);
double sinh(T x); // for integral type argument values

sinh() is a function of cmath library. Include cmath library at the start of program, if using sinh() function.

ADVERTISEMENT

Example

In this example, we read the value of angle from user into variable x, and find the hyperbolic sine value of x using sinh() function.

C++ Program

#include <iostream>
#include<cmath>
using namespace std;

int main() {
    double x;
    cout << "Enter angle (radians) : ";
    cin >> x;
    
    double result = sinh(x);
    cout << "sinh(" << x << ") : " << result << endl;
}

Output

Enter angle (radians) : 2
sinh(2) : 3.62686
Program ended with exit code: 0
Enter angle (radians) : 0
sinh(0) : 0
Program ended with exit code: 0
Enter angle (radians) : -2.3
sinh(-2.3) : -4.93696
Program ended with exit code: 0

Conclusion

In this C++ Tutorial, we learned the syntax of C++ sinh(), and how to use this function to find hyperbolic sine of given angle, with the help of examples.