sin、 sinf、 sinh、 sinhf
計算 sines 與雙曲線 sines。
double sin(
double x
);
float sin(
float x
); // C++ only
long double sin(
long double x
); // C++ only
float sinf(
float x
);
double sinh(
double x
);
float sinh(
float x
); // C++ only
long double sinh(
long double x
); // C++ only
float sinhf(
float x
);
參數
- x
以弧度表示角度。
傳回值
sin傳回的正弦函數x。 如果x是大於或等於 263,或小於或等於 –263,就會發生在結果中的重要性的遺失。
sinh傳回一數值的雙曲線正弦值x。 如果結果太大, sinh設定errno到ERANGE ,並傳回 ±HUGE_VAL,根據預設值。
輸入 |
SEH 例外狀況 |
Matherr 例外狀況 |
---|---|---|
± QNAN 尋找 |
None |
_DOMAIN |
± ∞ (sin,sinf) |
不正確 |
_DOMAIN |
|x|≥ 7.104760e + 002 (sinh,sinhf) |
溢位 + 是不正確 |
溢位 |
請參閱 _doserrno、 errno、 _sys_errlist,以及 _sys_nerr 如需有關這些項目,和其他的詳細資訊,任何傳回碼。
備註
C + + 允許多載化,因此使用者可以呼叫多載的sin和sinh該採取的雙精度浮點、 浮動、 長雙精度浮點型別。 在某 c 程式, sin和sinh函式永遠會傳回雙精度浮點和浮動,分別。
需求
常式 |
所需的標頭 |
---|---|
sin, sinf, sinh, sinhf |
<math.h> |
其他的相容性資訊,請參閱相容性在簡介中。
範例
// crt_sincos.c
// This program displays the sine, hyperbolic
// sine, cosine, and hyperbolic cosine of pi / 2.
//
#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 = sinh( x );
printf( "sinh( %f ) = %f\n",x, y );
y = cos( x );
printf( "cos( %f ) = %f\n", x, y );
y = cosh( x );
printf( "cosh( %f ) = %f\n",x, y );
}