Namespaces
Variants
Views
Actions

atanh

From cppreference.com
< c‎ | numeric‎ | math
Revision as of 04:40, 4 April 2014 by Newatthis (Talk | contribs)

 
 
 
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)(C99)(C99)
Exponential functions
(C99)
(C99)
(C99)
(C99)
Power functions
(C99)
(C99)
Trigonometric and hyperbolic functions
(C99)
(C99)
atanh
(C99)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Nearest integer floating point operations
(C99)(C99)(C99)
(C99)
(C99)(C99)(C99)
Floating point manipulation functions
(C99)(C99)
(C99)
(C99)
Classification
(C99)
(C99)
(C99)
Macro constants
 
Defined in header <math.h>
float       atanhf( float arg );
(since C99)
double      atanh( double arg );
(since C99)
long double atanhl( long double arg );
(since C99)

Computes area hyperbolic tangent of arg

Contents

Parameters

arg - floating point value

Return value

Inverse hyperbolic tangent of arg

Example

#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <fenv.h>
 
int main()
{
    printf("atanh(0.462117)  = %f\n",    atanh(0.462117));
    printf("tanh(0.5)        = %f\n",    tanh(0.5));         /* inverse of atanh */
    printf("atanh(+0.0)      = %+.1f\n", atanh(+0.0));
    printf("atanh(-0.0)      = %+.1f\n", atanh(-0.0));
    printf("atanh(NAN)       = %f\n",    atanh(NAN));
    printf("\n");
 
    {
        #pragma STDC FENV_ACCESS ON
 
        /* domain error                       */
        /* "invalid" floating-point exception */
        errno = 0; feclearexcept(FE_ALL_EXCEPT);
        printf("atanh(1.1)   = %f\n",   atanh(1.1));
        printf("errno        = %d\n",   errno);
        printf("FE_INVALID   = 0x%x\n", fetestexcept(FE_ALL_EXCEPT));
        printf("\n");
 
        /* range and pole errors                     */
        /* "divide-by-zero" floating-point exception */
        /* similarly, atanh(-1.0)                    */
        errno = 0; feclearexcept(FE_ALL_EXCEPT);
        printf("atanh(1.0)   = %f\n",   atanh(1.0));
        printf("errno        = %d\n",   errno);
        printf("FE_DIVBYZERO = 0x%x\n", fetestexcept(FE_ALL_EXCEPT));
 
    } // end FENV_ACCESS block
 
    return 0;
}

Possible output:

atanh(0.462117)  = 0.500000
tanh(0.5)        = 0.462117
atanh(+0.0)      = +0.0
atanh(-0.0)      = -0.0
atanh(NAN)       = nan
 
atanh(1.1)   = -nan
errno        = 33
FE_INVALID   = 0x1
 
atanh(1.0)   = inf
errno        = 34
FE_DIVBYZERO = 0x4

See also

(C99)(C99)(C99)
computes inverse hyperbolic sine (arsinh(x))
(function) [edit]
(C99)(C99)(C99)
computes inverse hyperbolic cosine (arcosh(x))
(function) [edit]
(C99)(C99)
computes hyperbolic tangent
(function) [edit]

External links

Weisstein, Eric W. "Inverse Hyperbolic Tangent." From MathWorld--A Wolfram Web Resource.