Math Acosh Function - C++ Programming Tutorial
C++ Course / Math Functions / Math Acosh Function

Math Acosh Function

BLUF: Mastering Math Acosh Function is a critical step in becoming a proficient C++ developer. This lesson provides a deep dive into the syntax, performance considerations, and real-world applications of this concept.
Key Performance Insight: Math Acosh Function

C++ is renowned for its efficiency. Learn how Math Acosh Function enables low-level control and high-performance computing in the tutorial below.

C++ Math acosh

The function calculates the inverse hyperbolic cosine of an angle provided in radians.

Where, an inverse hyperbolic cosine is the reciprocal function of hyperbolic cosine.

Syntax

Suppose an angle is 'x':

Example

float acosh(float x);
double acosh(double x);
long double acosh(long double x);
double acosh(integral x);

Parameter

x : The value for which the inverse hyperbolic cosine needs to be calculated.

Return value

It returns the arc hyperbolic cosine of x.

Example 1

Let's consider a straightforward example where the degree value is of integer type.

Example

#include <iostream>
#include<math.h>
using namespace std;
int main()
{
    int degree =30;
    float x = degree*3.14/180;
    std::cout << "Value of degree is : " <<degree<< std::endl;
    cout<<"cosh(x) : "<<cosh(x)<<'\n';
    cout<<"acosh(x) : "<<acosh(x);
    return 0;
}

Output:

Output

Value of degree is : 30
cosh(x) : 1.14009
acosh(x) : -nan

In this instance, the acosh method calculates the inverse hyperbolic cosine of x and outputs the result as -nan.

Example 2

Let's consider a basic example where the degree value is of type float.

Example

#include <iostream>
#include<math.h>
using namespace std;
int main()
{
    int degree =15.7;
    float x = degree*3.14/180;
    std::cout << "Value of degree is : " <<degree<< std::endl;
    cout<<"cosh(x) : "<<cosh(x)<<'\n';
    cout<<"acosh(x) : "<<acosh(x);
    return 0;
}

Output:

Output

Value of degree is : 15.7
cosh(x) : 1.03443
acosh(x) : -nan

In this instance, the acosh function calculates the inverse hyperbolic cosine of x and provides the result of -nan.

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience