標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
ISO C |
両方 |
#include <math.h>
double tan(double x);
float tan(float x); /* C++ only */
long double tan(long double x); /* C++ only */
float tanf(float x);
long double tanl(long double x);
x の計算された正接を戻します。
正しい値がアンダーフローの原因になった場合には、0 が戻されます。結果がオーバーフローすると、±HUGE_VAL が戻されます。アンダーフローとオーバーフローの両方の場合に、値 ERANGE が errno に保管されます。
⁄* CELEBT01
This example computes x as the tangent of PI⁄4.
*⁄
#include <math.h>
#include <stdio.h>
int main(void)
{
double pi, x;
pi = 3.1415926;
x = tan(pi⁄4.0);
printf("tan( %lf ) is %lf¥n", pi⁄4, x);
}
tan( 0.785398 ) is 1.000000