acospi
Compute the arccosine of the input real number and divide the arccosine by π.
Interface Definition
C interface:
float acospif(float x);
double acospi(double x);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of a cosine value. |
Input |
Return Value
- The result y is returned following the formula y = acos(x)/π. y ∈ [0, 1]
- If the input is ±0, the return value is 0.5.
- If the input x is 1, the return value is +0.
- If the input x is -1, the return value is 1.
- 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:
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 27 28 | // print result printf("acospi(0.0) = %.15f\n", acospi(0.0)); printf("acospi(-0.0) = %.15f\n", acospi(-0.0)); printf("acospi(0.25) = %.15f\n", acospi(0.25)); printf("acospi(-0.25) = %.15f\n", acospi(-0.25)); printf("acospi(0.5) = %.15f\n", acospi(0.5)); printf("acospi(-0.5) = %.15f\n", acospi(-0.5)); printf("acospi(1.0) = %.15f\n", acospi(1.0)); printf("acospi(-1.0) = %.15f\n", acospi(-1.0)); printf("acospi(INFINITY) = %.15f\n", acospi(INFINITY)); printf("acospi(-INFINITY) = %.15f\n", acospi(-INFINITY)); printf("acospi(NAN) = %.15f\n", acospi(NAN)); printf("acospi(-NAN) = %.15f\n", acospi(-NAN)); /* * acospi(0.0) = 0.500000000000000 * acospi(-0.0) = 0.500000000000000 * acospi(0.25) = 0.419569376744834 * acospi(-0.25) = 0.580430623255166 * acospi(0.5) = 0.333333333333333 * acospi(-0.5) = 0.666666666666667 * acospi(1.0) = 0.000000000000000 * acospi(-1.0) = 1.000000000000000 * acospi(INFINITY) = nan * acospi(-INFINITY) = nan * acospi(NAN) = nan * acospi(-NAN) = -nan * * */ |
Parent topic: Trigonometric Functions