计算输入角度的正切值。
C interface:
float tandf(float x);
double tand(double x);
long double tandl(long double x);
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
x |
|
表示角度的浮点值。 |
输入 |
C: "km.h"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | // typical usage float x1 = -1.0, x2 = 1.0, x3 = 0.5, x4 = -0.5; // special handling float a = 0.0, b = INFINITY, c = -INFINITY, d = NAN; // print result printf("tand(1.0) = %.15f\n", tand(x1)); printf("tand(-1.0) = %.15f\n", tand(x2)); printf("tand(0.5) = %.15f\n", tand(x3)); printf("tand(-0.5) = %.15f\n", tand(x4)); printf("tand(0.0) = %.15f\n", tand(a)); printf("tand(-0.0) = %.15f\n", tand(-a)); printf("tand(INFINITY) = %.15f\n", tand(b)); printf("tand(-INFINITY) = %.15f\n", tand(c)); printf("tand(NAN) = %.15f\n", tand(d)); /* * tand(1.0) = -0.017455064928218 * tand(-1.0) = 0.017455064928218 * tand(0.5) = 0.008726867790759 * tand(-0.5) = -0.008726867790759 * tand(0.0) = 0.000000000000000 * tand(-0.0) = -0.000000000000000 * tand(INFINITY) = nan * tand(-INFINITY) = nan * tand(NAN) = nan * * */ |