標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
ISO C |
両方 |
#include <math.h>
double sin(double x);
float sin(float x); /* C++ only */
long double sin(long double x); /* C++ only */
float sinf(float x);
long double sinl(long double x);
正常に実行された場合、関数は、double、浮動、または long double の値として表された計算値を戻します。 正常に実行されなかった場合には、結果がアンダーフローであると、関数は 0 を戻し、errno を ERANGE に設定します。
⁄* CELEBS27
This example computes y as the sine of &pi.&slr.2.
*⁄
#include <math.h>
#include <stdio.h>
int main(void)
{
double pi, x, y;
pi = 3.1415926535;
x = pi⁄2;
y = sin(x);
printf("sin( %lf ) = %lf¥n", x, y);
}
sin( 1.570796 ) = 1.000000