December 2005
Beginner to intermediate
618 pages
20h 19m
English
acosh
Calculates the inverse hyperbolic cosine of a number
include <math.h> doubleacosh( doublex); floatacoshf( floatx); long doubleacoshl( long doublex);
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.
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
Read now
Unlock full access