共用方式為


atanh, atanhf, atanhl

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at atanh, atanhf, atanhl.

Calculates the inverse hyperbolic tangent.

Syntax

double atanh(  
   double x   
);  
float atanh(  
   float x   
);  // C++ only  
long double atanh(  
   long double x  
);  // C++ only  
float atanhf(  
   float x   
);  
long double atanhl(  
   long double x  
);  

Parameters

x
Floating-point value.

Return Value

The atanh functions return the inverse hyberbolic tangent (arc hyperbolic tangent) of x. If x is greater than 1, or less than –1, errno is set to EDOM and the result is a quiet NaN. If x is equal to 1 or -1, a positive or negative infinity is returned, respectively, and errno is set to ERANGE.

Input SEH Exception Matherr Exception
± QNAN,IND none none
X ≥ 1; x ≤ -1 none none

Remarks

Because C++ allows overloading, you can call overloads of atanh that take and return float or long double values. In a C program, atanh always takes and returns double.

Requirements

Function C header C++ header
atanh, atanhf, atanhl <math.h> <cmath>

For additional compatibility information, see Compatibility.

Example

// crt_atanh.c  
// This program displays the hyperbolic tangent of pi / 4  
// and the arc hyperbolic tangent of the result.  
//  
  
#include <math.h>  
#include <stdio.h>  
  
int main( void )  
{  
   double pi = 3.1415926535;  
   double x, y;  
  
   x = tanh( pi / 4 );  
   y = atanh( x );  
   printf( "tanh( %f ) = %f\n", pi/4, x );  
   printf( "atanh( %f ) = %f\n", x, y );  
}  
tanh
( 0.785398 ) = 0.655794  
atanh
( 0.655794 ) = 0.785398  

.NET Framework Equivalent

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

See Also

Floating-Point Support
Long Double
acos, acosf, acosl
asin, asinf, asinl
atan, atanf, atanl, atan2, atan2f, atan2l
cos, cosf, cosl, cosh, coshf, coshl
sin, sinf, sinl, sinh, sinhf, sinhl
tan, tanf, tanl, tanh, tanhf, tanhl
_CItan