sin, sinf, sinl

浮動小数点値のサインを計算します。

構文

double sin(double x);
float sinf(float x);
long double sinl(long double x);
#define sin(x) // Requires C11 or higher
float sin(float x);  // C++ only
long double sin(long double x);  // C++ only

パラメーター

x
角度 (ラジアン)。

戻り値

sin 関数は、x のサイン値を返します。 x が 263 以上、または -263 以下の場合、結果で桁落ちが発生します。

入力 SEH 例外 _matherr 例外
± QNaN、IND なし _DOMAIN
± INF (sin, sinf, sinl) INVALID _DOMAIN

リターン コードの詳細については、「errno_doserrno_sys_errlist、および _sys_nerr」を参照してください。

解説

C++ ではオーバーロードが可能であるため、sin または float の値を受け取って返す long double のオーバーロードを呼び出すことができます。 C プログラムでは、この関数を呼び出すために <tgmath.h> マクロが使用されていない限り、sin は常に double を受け取って返します。

<tgmath.h> sin() マクロを使用する場合は、引数の型によって、選択される関数のバージョンが決定されます。 詳細については、「ジェネリック型数値演算」を参照してください。

既定では、この関数のグローバル状態の適用対象は、アプリケーションになります。 この動作を変更するには、「CRT のグローバル状態」を参照してください

必要条件

ルーチンによって返される値 必須ヘッダー (C) 必須ヘッダー (C++)
sin, sinf, sinl <math.h> <cmath> または <math.h>
sin マクロ <tgmath.h>

互換性の詳細については、「 Compatibility」を参照してください。

// crt_sincos.c
// This program displays the sine and cosine of pi / 2.
// Compile by using: cl /W4 crt_sincos.c

#include <math.h>
#include <stdio.h>

int main( void)
{
   double pi = 3.1415926535;
   double x, y;

   x = pi / 2;
   y = sin( x );
   printf( "sin( %f ) = %f\n", x, y );
   y = cos( x );
   printf( "cos( %f ) = %f\n", x, y );
}
sin( 1.570796 ) = 1.000000
cos( 1.570796 ) = 0.000000

関連項目

数学と浮動小数点のサポート
acos, acosf, acosl
asin, asinf, asinl
atan, atanf, atanl, atan2, atan2f, atan2l
cos, cosf, cosl
tan, tanf, tanl
_CIsin