Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c++
functions
communitycreator

What is the sinh() function in C++?

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

In C++, the sinh() function returns the hyperbolic sine of an angle given in radians of the argument X that is passed to the function.

Mathematically:

sinh(x) = sinhx

Also:

sinhx = (ex)(1/ex)2\frac{(e^x) - (1/e^x)}{2}

Syntax

double sinh(double x);
float sinh(float x);
long double sinh(long double x);

Parameter value

The sinh() function takes only one parameter value, x, which represents the hyperbolic angle in radian.

Return value

The sinh() function returns the hyperbolic sine of the argument x that is passed to it.

Code example

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
// creating our variables
int x = -10;
double result;
// implementing the sinh() function
result = sinh(x);
cout << "sinh(-10) = " << result << endl;
return 0;
}
Implementing the "sinh()" function

Code explanation

  • Lines 7–8: We create the variables result and x.

  • Line 11: We implement the sinh() function on the x variable and assign the output to the variable result.

  • Line 12: We print the result variable.

RELATED TAGS

c++
functions
communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring