---
title: atand
description: "计算输入实数的反正切值对应的角度。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/accel/kunpengaccel_kml_16_0367.html
sourcePath: /source/zh/kunpengboostkithistory/2300/accel/kunpengaccel_kml_16_0367.html
indexId: fd26d1c1e5c184f9a4635f3814b176961359aa078aa2407c2dd6044ccec9331074
---
# atand

计算输入实数的反正切值对应的角度。

#### 接口定义

C interface：

float atandf(float x);

double atand(double x);


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| x | 在atandf中，x是单精度浮点类型。 在atand中，x是双精度浮点类型。 | 表示输入数据的浮点值。 | 输入 |


#### 返回值

- 正常区间：返回输入x的反正切函数值对应的角度y=atan(x) * 180 / π，y ∈ [-90, +90]。
- 特殊区间：如下所示。| 输入值（x） | 输出值（y） |
| --- | --- |
| +0 | +0 |
| \-0 | \-0 |
| +inf | 90 |
| \-inf | \-90 |
| nan | nan |


#### 依赖

C: "km.h"


#### 示例

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("atand(1.0) = %.15f\n", atand(x1));
printf("atand(-1.0) = %.15f\n", atand(x2));
printf("atand(0.5) = %.15f\n", atand(x3));
printf("atand(-0.5) = %.15f\n", atand(x4));
printf("atand(0.0) = %.15f\n", atand(a));
printf("atand(-0.0) = %.15f\n", atand(-a));
printf("atand(INFINITY) = %.15f\n", atand(b));
printf("atand(-INFINITY) = %.15f\n", atand(c));
printf("atand(NAN) = %.15f\n", atand(d));
/*
*  atand(1.0) = -45.000000000000000
*  atand(-1.0) = 45.000000000000000
*  atand(0.5) = 26.565051177077990
*  atand(-0.5) = -26.565051177077990
*  atand(0.0) = 0.000000000000000
*  atand(-0.0) = -0.000000000000000
*  atand(INFINITY) = 90.000000000000000
*  atand(-INFINITY) = -90.000000000000000
*  atand(NAN) = nan
*
* */
```
