【问题标题】:getting unexpected result in acosh() in ios在 ios 中的 acosh() 中得到意外结果
【发布时间】:2015-01-13 12:55:31
【问题描述】:

我的代码如下
NSLog(@"result=%f",acosh([@"30.0" doubleValue]* M_PI / 180));
结果来了
result=nan
其中 M_PI 是 x 代码中预定义的宏

【问题讨论】:

    标签: ios macros


    【解决方案1】:

    30 * pi / 180

    根据 acosh 文档(例如这里:http://man7.org/linux/man-pages/man3/acosh.3.html,iOS 文档声明相同) 对于参数

    如果您为参数检查 acosh 的实际值:http://www.wolframalpha.com/input/?i=acosh%28pi+*+30.0+%2F+180%29,您会发现它是一个复数(实际上是假数)。

    【讨论】:

      猜你喜欢
      • 2021-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-12
      相关资源
      最近更新 更多