Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

trigonometry
acosh
c++
communitycreator

What is the acosh() 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

The acosh() function is used to return the inverse hyperbolic cosine in radians of the argument x passed to it.

Note: The arc hyperbolic cosine is the same as the inverse hyperbolic cosine.

Mathematically, this function is given by:

acosh(x) = acosh1acosh^{-1}x

Syntax

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

Parameters

This function takes x as the only and mandatory parameter value.

The value of this parameter must be equal to or greater than 1. When the value passed is less than 1, a domain error is returned.

Return value

The returned value is the arc hyperbolic cosine of the argument x.

Example

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

Explanation

  • Line 8 and 9: We create the variables x and result.

  • Line 12: We implement the acosh() function on the value of x and assign it to the variable result.

  • Line 13: We print the result variable.

RELATED TAGS

trigonometry
acosh
c++
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