EN
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助
鲲鹏小智

atan2pi

计算y/x的反正切值,并将结果再除以π。

接口定义

C interface:

float atan2pif(float y, float x);

double atan2pi(double y, double x);

参数

参数名

类型

描述

输入/输出

x

  • 在atan2df中,x是单精度浮点类型。
  • 在atan2d中,x是双精度浮点类型。

表示输入数据的浮点值。

输入

y

  • 在atan2df中,y是单精度浮点类型。
  • 在atan2d中,y是双精度浮点类型。

表示输入数据的浮点值。

输入

返回值

  • 正常区间:计算y/x的反正切值,并将结果再除以π,即result = atan(y/x) / π,res∈[-1, +1]。
  • 特殊区间:如下所示。

    输入值(y)

    输入值(x)

    输出值(result)

    +0

    +0

    +0

    +0

    -0

    +1

    +0

    inf

    +0

    +0

    -inf

    +1

    +0

    nan

    nan

    -0

    +0

    -0

    -0

    -0

    -1

    -0

    inf

    -0

    -0

    -inf

    -1

    -0

    nan

    nan

    inf

    +0

    0.5

    inf

    -0

    0.5

    inf

    inf

    0.25

    inf

    -inf

    0.75

    inf

    nan

    nan

    -inf

    +0

    -0.5

    -inf

    -0

    -0.5

    -inf

    inf

    -0.25

    -inf

    -inf

    -0.75

    -inf

    nan

    nan

    nan

    +0

    nan

    nan

    -0

    nan

    nan

    inf

    nan

    nan

    -inf

    nan

    nan

    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("atan2pi(1.0, 1.0) = %.15f\n", atan2pi(x1, x1));
    printf("atan2pi(-1.0, -1.0) = %.15f\n", atan2pi(x2, x2));
    printf("atan2pi(0.5, 0.5) = %.15f\n", atan2pi(x3, x3));
    printf("atan2pi(-0.5, -0.5) = %.15f\n", atan2pi(x4, x4));
    printf("atan2pi(0.0, 0.0) = %.15f\n", atan2pi(a, a));
    printf("atan2pi(-0.0, -0.0) = %.15f\n", atan2pi(-a, -a));
    printf("atan2pi(INFINITY, INFINITY) = %.15f\n", atan2pi(b, b));
    printf("atan2pi(-INFINITY, -INFINITY) = %.15f\n", atan2pi(c, c));
    printf("atan2pi(NAN, NAN) = %.15f\n", atan2pi(d, d));
    /*
     *  atan2pi(1.0, 1.0) = -0.750000000000000
     *  atan2pi(-1.0, -1.0) = 0.250000000000000
     *  atan2pi(0.5, 0.5) = 0.250000000000000
     *  atan2pi(-0.5, -0.5) = -0.750000000000000
     *  atan2pi(0.0, 0.0) = 0.000000000000000
     *  atan2pi(-0.0, -0.0) = -1.000000000000000
     *  atan2pi(INFINITY, INFINITY) = 0.250000000000000
     *  atan2pi(-INFINITY, -INFINITY) = -0.750000000000000
     *  atan2pi(NAN, NAN) = nan
     *
     * */
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词