How to use sinh() function to get the hyperbolic sine of an angle of N radians in C++

1 Answer

0 votes
#include <iostream>
#include <cmath>

using namespace std;

#define PI 3.14159265

int main()
{
	cout << "sinh(PI / 6) = " << sinh(PI / 6) << endl;
	cout << "sinh(PI / 2) = " << sinh(PI / 2) << endl;
	cout << "sinh(PI / 180) = " << sinh(PI / 180) << endl;
	cout << "sinh(-2 * PI / 4) = " << sinh(-2 * PI / 4) << endl;
	cout << "sinh(+0) = " << sinh(0.0) << endl;
	cout << "sinh(-0) = " << sinh(-0.0) << endl;
	cout << "sinh(+1) = " << sinh(1.0) << endl;
	cout << "sinh(-1) = " << sinh(-1.0) << endl;
	cout << "sinh(log(2.0)) = " << sinh(log(2.0)) << endl;

	return 0;
}

/*
run:

sinh(PI / 6) = 0.547853
sinh(PI / 2) = 2.3013
sinh(PI / 180) = 0.0174542
sinh(-2 * PI / 4) = -2.3013
sinh(+0) = 0
sinh(-0) = -0
sinh(+1) = 1.1752
sinh(-1) = -1.1752
sinh(log(2.0)) = 0.75

*/

 



answered Mar 30, 2016 by avibootz
...