How to use acosh() function to get the arc hyperbolic cosine value of N in C++

2 Answers

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

using namespace std;

int main()
{
	cout << "acosh(1.2) = " << acosh(1.2) << endl;

	double ac = acos(.9);
	cout << "acosh(.9) = " << ac << endl;

	return 0;
}


/*
run:

acosh(1.2) = 0.622363
acosh(.9) = 0.451027

*/

 



answered Mar 12, 2016 by avibootz
0 votes
#include <iostream>
#include <cmath>
#include <cfloat>      

using namespace std;

int main()
{
	cout << "acosh(1) = " << acosh(1) << endl;
	cout << "acosh(0) = " << acosh(0) << endl;
	cout << "acosh(10) = " << acosh(10) << endl;
	cout << "acosh(0.5) = " << acosh(0.5) << endl;;
	cout << "acosh(DBL_MAX) = " << acosh(DBL_MAX) << endl;
	cout << "acosh(INFINITY) = " << acosh(INFINITY) << endl;

	return 0;
}

// "NAN" is "not-a-number" - applies to float and double

/*
run:

acosh(1) = 0
acosh(0) = nan
acosh(10) = 2.99322
acosh(0.5) = nan
acosh(DBL_MAX) = 710.476
acosh(INFINITY) = inf

*/

 



answered Mar 12, 2016 by avibootz
edited Mar 12, 2016 by avibootz
...