Name
atanh
Synopsis
Calculates the inverse hyperbolic tangent of a number
include <math.h> doubleatanh
( doublex
); floatatanhf
( floatx
); long doubleatanhl
( long doublex
);
The atanh()
functions
return the number whose hyperbolic tangent is equal to their
argument x
. Because the hyperbolic
tangent of any number is between -1 and +1, atanh()
incurs a domain error if the
absolute value of the argument is greater than 1. Furthermore, a
range error may result if the absolute value of the argument is
equal to 1.
Example
double x[ ] = { -1.0, -0.5, 0.0, 0.5, 0.99, 1.0, 1.01 };
puts(" x atanh(x) \n"
" ---------------------------------------");
for ( int i = 0; i < sizeof(x) / sizeof(x[0]); ++i )
{
errno = 0;
printf("%+15.2f %+20.10f\n", x[i],atanh
(x[i]) );
if ( errno)
perror("atanh");
}
This code produces the following output:
x atanh(x) --------------------------------------- -1.00 -inf atanh: Numerical argument out of domain -0.50 -0.5493061443 +0.00 +0.0000000000 +0.50 +0.5493061443 +0.99 +2.6466524124 +1.00 +inf atanh: Numerical argument out of domain +1.01 +nan atanh: Numerical argument out of domain
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.