Namespaces
Variants

asin, asinf, asinl

From cppreference.net
< c ‎ | numeric ‎ | math
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99) (C99) (C99) (C23)
Maximum/minimum operations
Exponential functions
Power functions
Trigonometric and hyperbolic functions
Nearest integer floating-point
(C99) (C99) (C99)
(C23) (C23) (C23) (C23)
Floating-point manipulation
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
Arguments and return values
Error handling
Fast operation indicators
ヘッダーで定義 <math.h>
float asinf ( float arg ) ;
(1) (C99以降)
double asin ( double arg ) ;
(2)
long double asinl ( long double arg ) ;
(3) (C99以降)
_Decimal32  asind32 ( _Decimal32 arg ) ;
(4) (C23以降)
_Decimal64  asind64 ( _Decimal64 arg ) ;
(5) (C23以降)
_Decimal128 asind128 ( _Decimal128 arg ) ;
(6) (C23以降)
ヘッダーで定義 <tgmath.h>
#define asin( arg )
(7) (C99以降)
1-6) arg の逆正弦の主値を計算します。
7) 型総称マクロ: 引数の型が long double の場合、 (3) ( asinl )が呼び出される。そうでなく、引数が整数型または double 型の場合、 (2) ( asin )が呼び出される。それ以外の場合、 (1) ( asinf )が呼び出される。引数が複素数の場合、マクロは対応する複素数関数( casinf casin casinl )を呼び出す。

関数 (4-6) は、実装が __STDC_IEC_60559_DFP__ を事前定義する場合にのみ宣言される(すなわち、実装が十進浮動小数点数をサポートする場合)。

(C23以降)

目次

翻訳の説明: - 「Contents」を「目次」に翻訳しました - C++関連の専門用語(Parameters, Return value, Error handling, Example, References, See also)は原文のまま保持しました - HTMLタグ、属性、クラス名、ID、リンク先は一切変更していません - 数値や書式設定は完全に保持されています

パラメータ

arg - 浮動小数点値

戻り値

If no errors occur, the arc sine of arg ( arcsin(arg) ) in the range [-
π
2
; +
π
2
]
, is returned.

定義域エラーが発生した場合、実装定義の値が返されます(NaNがサポートされている場合はNaN)。

アンダーフローによる範囲エラーが発生した場合、正しい結果(丸め後)が返されます。

エラー処理

エラーは math_errhandling で指定された通りに報告されます。

ドメインエラーは、 arg が範囲 [-1.0; 1.0] の外側にある場合に発生します。

IEEE浮動小数点演算(IEC 60559)がサポートされている実装の場合:

  • 引数が±0の場合、変更されずに返される;
  • |arg| > 1 の場合、定義域エラーが発生しNaNが返される;
  • 引数がNaNの場合、NaNが返される。

#include <errno.h>
#include <fenv.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#ifndef __GNUC__
#pragma STDC FENV_ACCESS ON
#endif
int main(void)
{
    printf("asin( 1.0) = %+f, 2*asin( 1.0)=%+f\n", asin(1), 2 * asin(1));
    printf("asin(-0.5) = %+f, 6*asin(-0.5)=%+f\n", asin(-0.5), 6 * asin(-0.5));
    // 特殊値
    printf("asin(0.0) = %1f, asin(-0.0)=%f\n", asin(+0.0), asin(-0.0));
    // エラー処理
    errno = 0; feclearexcept(FE_ALL_EXCEPT);
    printf("asin(1.1) = %f\n", asin(1.1));
    if (errno == EDOM)
        perror("    errno == EDOM");
    if (fetestexcept(FE_INVALID))
        puts("    FE_INVALID raised");
}

出力例:

asin( 1.0) = +1.570796, 2*asin( 1.0)=+3.141593
asin(-0.5) = -0.523599, 6*asin(-0.5)=-3.141593
asin(0.0) = 0.000000, asin(-0.0)=-0.000000
asin(1.1) = nan
    errno == EDOM: Numerical argument out of domain
    FE_INVALID raised

参考文献

  • C23規格 (ISO/IEC 9899:2024):
  • 7.12.4.2 asin関数群 (p: 未定)
  • 7.25 総称数学 <tgmath.h> (p: 未定)
  • F.10.1.2 asin関数群 (p: 未定)
  • C17規格 (ISO/IEC 9899:2018):
  • 7.12.4.2 asin関数群 (p: 174)
  • 7.25 総称数学 <tgmath.h> (p: 272-273)
  • F.10.1.2 asin関数群 (p: 378)
  • C11規格 (ISO/IEC 9899:2011):
  • 7.12.4.2 asin関数群 (p: 238)
  • 7.25 総称数学 <tgmath.h> (p: 373-375)
  • F.10.1.2 asin関数群 (p: 518)
  • C99規格 (ISO/IEC 9899:1999):
  • 7.12.4.2 asin関数 (p: 219)
  • 7.22 総称型数学 <tgmath.h> (p: 335-337)
  • F.9.1.2 asin関数 (p: 456)
  • C89/C90標準 (ISO/IEC 9899:1990):
  • 4.5.2.2 asin関数

関連項目

(C99) (C99)
アークコサインを計算する ( arccos(x) )
(関数)
(C99) (C99)
アークタンジェントを計算する ( arctan(x) )
(関数)
符号を使用して象限を決定するアークタンジェントを計算する
(関数)
(C99) (C99)
サインを計算する ( sin(x) )
(関数)
(C99) (C99) (C99)
複素数のアークサインを計算する
(関数)