atanpi
Compute the arctangent of the input real number and divide the arctangent by π.
Interface Definition
C interface:
float atanpif(float x);
double atanpi(double x);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of the input data. |
Input |
Return Value
- Normal range: The result y is returned following the formula y = atan(x)/π. y ∈ [-0.5, +0.5]
- Special values: See the following table.
Input Value (x)
Output Value (y)
+0
+0
-0
-0
+inf
0.5
-inf
-0.5
NaN
NaN
Dependency
C: "km.h"
Example
C interface:
// 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("atanpi(1.0) = %.15f\n", atanpi(x1));
printf("atanpi(-1.0) = %.15f\n", atanpi(x2));
printf("atanpi(0.5) = %.15f\n", atanpi(x3));
printf("atanpi(-0.5) = %.15f\n", atanpi(x4));
printf("atanpi(0.0) = %.15f\n", atanpi(a));
printf("atanpi(-0.0) = %.15f\n", atanpi(-a));
printf("atanpi(INFINITY) = %.15f\n", atanpi(b));
printf("atanpi(-INFINITY) = %.15f\n", atanpi(c));
printf("atanpi(NAN) = %.15f\n", atanpi(d));
/*
* atanpi(1.0) = -0.250000000000000
* atanpi(-1.0) = 0.250000000000000
* atanpi(0.5) = 0.147583617650433
* atanpi(-0.5) = -0.147583617650433
* atanpi(0.0) = 0.000000000000000
* atanpi(-0.0) = -0.000000000000000
* atanpi(INFINITY) = 0.500000000000000
* atanpi(-INFINITY) = -0.500000000000000
* atanpi(NAN) = nan
*
* */
Parent topic: Function Syntax