atanh, atanhf, atanhl
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <math.h> で定義
|
||
float atanhf( float arg ); |
(1) | (C99以上) |
double atanh( double arg ); |
(2) | (C99以上) |
long double atanhl( long double arg ); |
(3) | (C99以上) |
| ヘッダ <tgmath.h> で定義
|
||
#define atanh( arg ) |
(4) | (C99以上) |
1-3)
arg の逆双曲線正接を計算します。4) 型総称マクロ。 引数が
long double 型の場合は atanhl が呼ばれます。 そうでなく、引数が整数型または double 型の場合は atanh が呼ばれます。 そうでなければ atanhf が呼ばれます。 引数が複素数の場合、マクロは対応する複素数の関数 (catanhf, catanh, catanhl) を呼びます。引数
| arg | - | 双曲的扇型の面積を表す浮動小数点値 |
戻り値
エラーが発生しなければ、 arg の逆双曲線正接 (tanh-1
(arg) または artanh(arg)) が返されます。
定義域エラーが発生した場合、処理系定義の値 (サポートされていれば NaN) が返されます。
極エラーが発生した場合、 ±HUGE_VAL、 ±HUGE_VALF または ±HUGE_VALL が返されます (正しい符号を持ちます)。
アンダーフローによる値域エラーが発生した場合、 (丸めた後の) 正しい結果が返されます。
エラー処理
math_errhandling で規定されている通りにエラーが報告されます。
引数が区間 [-1, +1] 上でない場合、値域エラーが発生します。
引数が ±1 の場合、極エラーが発生します。
処理系が IEEE 浮動小数点算術 (IEC 60559) をサポートしている場合、
- 引数が ±0 であれば、それが変更されずに返されます。
- 引数が ±1 であれば、 ±∞ が返され、 FE_DIVBYZERO が発生します。
- |arg|>1 であれば、 NaN が返され、 FE_INVALID が発生します。
- 引数が NaN であれば、 NaN が返されます。
ノート
C 標準は、この関数に「arc hyperbolic tangent」と名付けていますが、双曲線関数の逆関数は面積関数です。 引数は双曲的扇形の面積であり、円弧 (arc) ではありません。 正しい名前は「inverse hyperbolic tangent」 (POSIX で使用されています) または「area hyperbolic tangent」です。
POSIX は、アンダーフローの場合、 arg が変更されずに返され、それがサポートされない場合、 DBL_MIN、 FLT_MIN、 LDBL_MIN より小さくない処理系定義の値が返されると規定しています。
例
Run this code
#include <stdio.h>
#include <math.h>
#include <float.h>
#include <errno.h>
#include <fenv.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 handling
errno = 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");
}
出力例:
atanh(0) = 0.000000
atanh(-0) = -0.000000
atanh(0.9) = 1.472219
atanh(-1) = -inf
errno == ERANGE: Numerical result out of range
FE_DIVBYZERO raised
参考文献
- 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)
関連項目
(C99)(C99)(C99) |
逆双曲線正弦 (arsinh(x)) を計算します (関数) |
(C99)(C99)(C99) |
逆双曲線余弦 (arcosh(x)) を計算します (関数) |
(C99)(C99) |
双曲線正接 (tanh(x)) を計算します (関数) |
(C99)(C99)(C99) |
複素数逆双曲線正接を計算します (関数) |
atanh の C++リファレンス
| |
外部リンク
Weisstein, Eric W. "Inverse Hyperbolic Tangent." From MathWorld--A Wolfram Web Resource.