cotd
Compute the cotangent of the input angle.
Interface Definition
C interface:
float cotdf(float x);
double cotd(double x);
long double cotdl(long double x);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value representing an angle. |
Input |
Return Value
- Normal range: The cotangent y of angle x is returned, that is, y = cot(x * π/180). y ∈ [-∞, +∞]
- If the input x = 180 * k (k is an integer), the output is ±inf.
- If the input x = 180 * k + 90 (k is an integer), the output is ±0.
- If the input |x| = inf or NaN, the output is NaN.
Dependency
C: "km.h"
Example
C interface:
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("cotd(1.0) = %.15f\n", cotd(x1)); printf("cotd(-1.0) = %.15f\n", cotd(x2)); printf("cotd(0.5) = %.15f\n", cotd(x3)); printf("cotd(-0.5) = %.15f\n", cotd(x4)); printf("cotd(0.0) = %.15f\n", cotd(a)); printf("cotd(-0.0) = %.15f\n", cotd(-a)); printf("cotd(INFINITY) = %.15f\n", cotd(b)); printf("cotd(-INFINITY) = %.15f\n", cotd(c)); printf("cotd(NAN) = %.15f\n", cotd(d)); /* * cotd(1.0) = -57.289961630759421 * cotd(-1.0) = 57.289961630759421 * cotd(0.5) = 114.588650129309613 * cotd(-0.5) = -114.588650129309613 * cotd(0.0) = inf * cotd(-0.0) = -inf * cotd(INFINITY) = nan * cotd(-INFINITY) = nan * cotd(NAN) = nan * * */ |
Parent topic: Trigonometric Functions