cosh(3C)
_________________________________________________________________
cosh $builtin function
Return the hyperbolic cosine of a number.
_________________________________________________________________
Calling Sequence
double m, n, cosh();
m = cosh(n);
(or)
$builtin double cosh();
double m, n;
m = cosh(n);
where m and n are of type double.
Description
Use the cosh function to find the hyperbolic cosine of a number;
m will receive the value of the hyperbolic cosine of n.
The first version of the calling sequence above uses a function
call. The second might generate smaller or faster code, but
might not run under other C compilers.
The include file math.h defines this function, and uses the
$builtin version. Using the include file will not cause any
portability problems.
This function does not check for type double.
Returns
The cosh function returns the hyperbolic cosine of the number you
pass. If floating-point overflow or underflow occurs, this
function returns the largest possible floating point number (with
the correct sign) and sets errno to ERANGE (defined in errno.h).
Related Functions
See also the acos and cos functions.
Example
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
cosh(3C)
/* Program test for the cosh() function */
#include <math.h>
double m, n, atof(), cosh();
int i = 1;
main(argc, argv)
int argc;
char *argv[];
{
while (i < argc) {
n = atof(argv[i]);
printf("The hyperbolic cosine of %f is %f.\n",
n, m = cosh(n));
i++;
}
}
If you call the program test with the input numbers
5.55
0.555
0.0555
0.00555
you get the output
The hyperbolic cosine of 5.550000 is 128.620722.
The hyperbolic cosine of 0.555000 is 1.158007.
The hyperbolic cosine of 0.055500 is 1.001541.
The hyperbolic cosine of 0.005550 is 1.000015.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)