Calculates the arc hyperbolic cosine function of a double precision floating-point value.
Include
<math.h>
Prototype
double acosh(double x);
Argument
x
Return Value
Returns the arc hyperbolic cosine of x
.
Remarks
A range error will occur if the argument is less than 1.
Example
#include <math.h>
#include <stdio.h>
#include <errno.h>
int main(void)
{
double x, y;
errno = 0;
x = 0.0;
y = acosh(x);
if (errno)
perror("Error");
printf("The arc hyperbolic cosine of %f is %f\n", x, y);
errno = 0;
x = 1.0;
y = acosh(x);
if (errno)
perror("Error");
printf("The arc hyperbolic cosine of %f is %f\n", x, y);
errno = 0;
x = 720.0;
y = acosh(x);
if (errno)
perror("Error");
printf("The arc hyperbolic cosine of %f is %f\n", x, y);
}
Example Output
Error: range error
The arc hyperbolic cosine of 0.000000 is nan
The arc hyperbolic cosine of 1.000000 is 0.000000
The arc hyperbolic cosine of 720.000000 is 7.272398