Previous Page
Next Page

acosh

Calculates the inverse hyperbolic cosine of a number

include <math.h>
double acosh ( double x  );
float acoshf ( float x  );
long double acoshl ( long double x  );

The acosh( ) functions return the non-negative number whose hyperbolic cosine is equal to the argument x. Because the hyperbolic cosine of any number is greater than or equal to 1, acosh( ) incurs a domain error if the argument is less than 1.

Example

double x, y1, y2;

puts("acosh(x) is equal to log( x + sqrt(x*x - 1))\n");
puts("For the argument x, enter some numbers greater than or equal to 1.0"
     "\n(type any letter to quit):");
while ( scanf("%lf", &x) == 1)
{
  errno = 0;
  y1 = acosh(x);
  if ( errno == EDOM)
  {
    perror("acosh");   break;
  }
  y2 = log( x + sqrt( x*x - 1));
  printf("x = %f;  acosh(x) = %f;  log(x + sqrt(x*x-1)) = %f\n", x, y1, y2);
}

This code produces the following output:

For the argument x, enter some numbers greater than or equal to 1.0
(type any letter to quit):
1.5
x = 1.500000;  acosh(x) = 0.962424;  log(x + sqrt(x*x-1)) = 0.962424
0.5
acosh: Numerical argument out of domain

See Also

Other hyperbolic trigonometry functions for real numbers: asinh( ), atanh( ), sinh( ), cosh( ), and tanh( ); the hyperbolic cosine and inverse hyperbolic cosine functions for complex numbers: ccosh( ) and cacosh( )


Previous Page
Next Page