acosd
Compute the degree corresponding to the arccosine of the input real number.
Interface Definition
C interface:
float acosdf(float x);
double acosd(double x);
long double acosdl(long double x);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of the input data. |
Input |
Return Value
- The degree y corresponding to the arccosine of the input x is returned, that is, y = acos(x) * 180/π. y ∈ [0, 180]
- If the input is +0, the return value is 90.
- If the input is -0, the return value is 90.
- If the input x is 1, the return value is +0.
- If the input x is -1, the return value is 180.
- If the input |x| is greater than 1, the return value is NaN.
- If the input is ±∞, the return value is NaN.
- If the input is NaN, the return value is NaN.
Dependency
C: "km.h"
Example
C interface:
// typical usage
float x1 = -1.0, x2 = 1.0, x3 = 0.5, x4 = -0.5;
float a = 0.0, b = INFINITY, c = -INFINITY, d = NAN;
// print result
printf("acosdf(1.0) = %.15f\n", acosdf(x1));
printf("acosdf(-1.0) = %.15f\n", acosdf(x2));
printf("acosdf(0.5) = %.15f\n", acosdf(x3));
printf("acosdf(-0.5) = %.15f\n", acosdf(x4));
printf("acosdf(0.0) = %.15f\n", acosdf(a));
printf("acosdf(-0.0) = %.15f\n", acosdf(-a));
printf("acosdf(INFINITY) = %.15f\n", acosdf(b));
printf("acosdf(-INFINITY) = %.15f\n", acosdf(c));
printf("acosdf(NAN) = %.15f\n", acosdf(d));
/*
* acosdf(1.0) = 180.000000000000000
* acosdf(-1.0) = 0.000000000000000
* acosdf(0.5) = 60.000000000000000
* acosdf(-0.5) = 120.000000000000000
* acosdf(0.0) = 90.000000000000000
* acosdf(-0.0) = 90.000000000000000
* acosdf(INFINITY) = nan
* acosdf(-INFINITY) = nan
* acosdf(NAN) = nan
*
* */
Parent topic: Trigonometric Functions