tanh(3C)
_________________________________________________________________
tanh $builtin function
Determine the hyperbolic tangent of a number.
_________________________________________________________________
Calling Sequence
double m, n, tanh();
m = tanh(n);
(or)
$builtin double tanh();
double m, n;
m = tanh(n);
where m and n are of type double.
Description
Use the tanh function to find the hyperbolic tangent of a number.
The first version 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 entry, and uses
the $builtin version.
Returns
The tanh function returns the hyperbolic tangent of the number
you specify.
Related Functions
See also the tan function.
Example
/* Program test for the tanh() function */
#include <math.h>
double m, n, atof(), tanh();
int i = 1;
main(argc, argv)
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
tanh(3C)
int argc;
char *argv[];
{
while (i < argc) {
n = atof(argv[i]);
printf("Hyperbolic tangent of %lf = %lf.\n",
n, m = tanh(n));
i++;
}
}
A call to the program test with
x test [inputnos]
where the file input_nos contains
10 &
1 &
0.1 &
0.01
generates the output
Hyperbolic tangent of 10.000000 = 0.999999.
Hyperbolic tangent of 1.000000 = 0.761594.
Hyperbolic tangent of 0.100000 = 0.099667.
Hyperbolic tangent of 0.010000 = 0.009999.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)