Ads by ProfitSence
Close

C++ acosh()

Last Updated on Wednesday 5th Oct 2022

arcosh

The C++ acosh() function returns the arc hyperbolic cosine of a number in radians and it takes a single argument.

Syntax

			
					 acosh(x)

			
	

Parameters

The acosh() function takes a one argument which is greater or equal to 1.

If the argument is less than 1, a domain error occurs.

Return value

Returns a value in the range [0, ∞].If the argument is less than 1, it returns NaN (not a number).

acosh() prototype [As of C++ 11 standard]

			
					double acosh(double x);
float acosh(float x);
long double acosh(long double x);
double acosh(T x); // For integral type

			
	

Example 1: C++ acosh()

			
					#include <stdio.h>
#include <math.h>

int main () {
  double param, result;
  param = 12.1212;
  result = acosh(param);
  printf ("The area hyperbolic cosine of %f is %f radians.\n", param, result);
  return 0;
}

			
	

Output

			
					The area hyperbolic cosine of 12.121200 is 3.186397 radians.

			
	

Example 2 : C++ acosh() ( With Negative Value )

As i said, If the argument is less than 1 , then acosh() returns NaN i.e. not a number.

			
					#include <stdio.h>
#include <math.h>

int main () {
  double param, result;
  param = -11.1;
  result = acosh(param);
  printf ("%f", result);
  return 0;
}

			
	

Output

			
					-nan