Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      atanh, atanhf, atanhl

      From cppreference.com
      <c‎ |numeric‎ |math
       
       
       
      Common mathematical functions
      Functions
      Basic operations
      (C99)
      (C99)
      (C99)
      (C99)(C99)(C99)(C23)
      Maximum/minimum operations
      (C99)
      (C99)
      Exponential functions
      (C23)
      (C99)
      (C99)
      (C23)
      (C23)

      (C99)
      (C99)(C23)
      (C23)
      (C23)
      Power functions
      (C99)
      (C23)
      (C23)

      (C99)
      (C23)
      (C23)
      Trigonometric and hyperbolic functions
      (C23)
      (C23)
      (C23)
      (C23)
      (C99)
      (C99)
      atanh
      (C99)
      Nearest integer floating-point
      (C99)(C99)(C99)
      (C23)(C23)(C23)(C23)
      Floating-point manipulation
      (C99)(C99)
      (C99)(C23)
      (C99)
      Narrowing operations
      (C23)
      (C23)
      (C23)
      (C23)
      (C23)
      (C23)
      Quantum and quantum exponent
      Decimal re-encoding functions
      Total order and payload functions
      Classification
      Error and gamma functions
      (C99)
      (C99)
      (C99)
      (C99)
      Types
      Macro constants
      Special floating-point values
      (C99)(C23)
      Arguments and return values
      Error handling
      Fast operation indicators
       
      Defined in header<math.h>
      float       atanhf(float arg);
      (1)(since C99)
      double      atanh(double arg);
      (2)(since C99)
      longdouble atanhl(longdouble arg);
      (3)(since C99)
      Defined in header<tgmath.h>
      #define atanh( arg )
      (4)(since C99)
      1-3) Computes the inverse hyperbolic tangent ofarg.
      4) Type-generic macro: If the argument has typelongdouble,atanhl is called. Otherwise, if the argument has integer type or the typedouble,atanh is called. Otherwise,atanhf is called. If the argument is complex, then the macro invokes the corresponding complex function (catanhf,catanh,catanhl).

      Contents

      [edit]Parameters

      arg - floating_point value representing the area of a hyperbolic sector

      [edit]Return value

      If no errors occur, the inverse hyperbolic tangent ofarg (tanh-1
      (arg)
      , orartanh(arg)), is returned.

      If a domain error occurs, an implementation-defined value is returned (NaN where supported).

      If a pole error occurs,±HUGE_VAL,±HUGE_VALF, or±HUGE_VALL is returned (with the correct sign).

      If a range error occurs due to underflow, the correct result (after rounding) is returned.

      [edit]Error handling

      Errors are reported as specified inmath_errhandling.

      If the argument is not on the interval[-1+1], a range error occurs.

      If the argument is ±1, a pole error occurs.

      If the implementation supports IEEE floating-point arithmetic (IEC 60559),

      • If the argument is ±0, it is returned unmodified.
      • If the argument is ±1, ±∞ is returned andFE_DIVBYZERO is raised.
      • If|arg|>1, NaN is returned andFE_INVALID is raised.
      • If the argument is NaN, NaN is returned.

      [edit]Notes

      Although the C standard names this function "arc hyperbolic tangent", the inverse functions of the hyperbolic functions are the area functions. Their argument is the area of a hyperbolic sector, not an arc. The correct name is "inverse hyperbolic tangent" (used by POSIX) or "area hyperbolic tangent".

      POSIX specifies that in case of underflow,arg is returned unmodified, and if that is not supported, an implementation-defined value no greater thanDBL_MIN,FLT_MIN, andLDBL_MIN is returned.

      [edit]Example

      Run this code
      #include <errno.h>#include <fenv.h>#include <float.h>#include <math.h>#include <stdio.h>// #pragma STDC FENV_ACCESS ON int main(void){printf("atanh(0) = %f\natanh(-0) = %f\n", atanh(0), atanh(-0.0));printf("atanh(0.9) = %f\n", atanh(0.9)); // error handlingerrno=0;feclearexcept(FE_ALL_EXCEPT);printf("atanh(-1) = %f\n", atanh(-1));if(errno==ERANGE)perror("    errno == ERANGE");if(fetestexcept(FE_DIVBYZERO))puts("    FE_DIVBYZERO raised");}

      Possible output:

      atanh(0) = 0.000000atanh(-0) = -0.000000atanh(0.9) = 1.472219atanh(-1) = -inf    errno == ERANGE: Numerical result out of range    FE_DIVBYZERO raised

      [edit]References

      • C23 standard (ISO/IEC 9899:2024):
      • 7.12.5.3 The atanh functions (p: 241)
      • 7.25 Type-generic math <tgmath.h> (p: 373-375)
      • F.10.2.3 The atanh functions (p: 520)
      • C17 standard (ISO/IEC 9899:2018):
      • 7.12.5.3 The atanh functions (p: TBD)
      • 7.25 Type-generic math <tgmath.h> (p: TBD)
      • F.10.2.3 The atanh functions (p: TBD)
      • C11 standard (ISO/IEC 9899:2011):
      • 7.12.5.3 The atanh functions (p: 241)
      • 7.25 Type-generic math <tgmath.h> (p: 373-375)
      • F.10.2.3 The atanh functions (p: 520)
      • C99 standard (ISO/IEC 9899:1999):
      • 7.12.5.3 The atanh functions (p: 221-222)
      • 7.22 Type-generic math <tgmath.h> (p: 335-337)
      • F.9.2.3 The atanh functions (p: 457)

      [edit]See also

      (C99)(C99)(C99)
      computes inverse hyperbolic sine (\({\small\operatorname{arsinh}{x} }\)arsinh(x))
      (function)[edit]
      (C99)(C99)(C99)
      computes inverse hyperbolic cosine (\({\small\operatorname{arcosh}{x} }\)arcosh(x))
      (function)[edit]
      (C99)(C99)
      computes hyperbolic tangent (\({\small\tanh{x} }\)tanh(x))
      (function)[edit]
      (C99)(C99)(C99)
      computes the complex arc hyperbolic tangent
      (function)[edit]

      [edit]External links

      Weisstein, Eric W. "Inverse Hyperbolic Tangent." From MathWorld — A Wolfram Web Resource.
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/numeric/math/atanh&oldid=172077"

      [8]ページ先頭

      ©2009-2025 Movatter.jp