std::asinh, std::asinhf, std::asinhl
来自cppreference.com
<tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
| 在标头 <cmath> 定义
|
||
| (1) | ||
float asinh ( float num ); double asinh ( double num ); long double asinh ( long double num ); |
(C++23 前) | |
/* 浮点数类型 */ asinh ( /* 浮点数类型 */ num ); |
(C++23 起) (C++26 起 constexpr) |
|
float asinhf( float num ); |
(2) | (C++11 起) (C++26 起为 constexpr) |
long double asinhl( long double num ); |
(3) | (C++11 起) (C++26 起为 constexpr) |
| SIMD 重载 (C++26 起) |
||
| 在标头 <simd> 定义
|
||
template< /*math-floating-point*/ V > constexpr /*deduced-simd-t*/<V> asinh ( const V& v_num ); |
(S) | (C++26 起) |
| 额外重载 (C++11 起) |
||
| 在标头 <cmath> 定义
|
||
template< class Integer > double asinh ( Integer num ); |
(A) | (C++26 起为 constexpr) |
1-3) 计算
num 的反双曲正弦。标准库提供所有以无 cv 限定的浮点数类型作为形参的类型的 std::asinh 重载。(C++23 起)|
S) SIMD 重载对
v_num 实施逐元素 std::asinh。
|
(C++26 起) |
|
A) 为所有整数类型提供额外重载,将它们当做
double。 |
(C++11 起) |
参数
| num | - | 浮点数或整数 |
返回值
如果没有发生错误,那么返回 num 的反双曲正弦(sinh-1
(num) 或 arsinh(num))。
如果发生下溢导致的值域错误,那么返回(舍入后的)正确结果。
错误处理
报告 math_errhandling 中指定的错误。
如果实现支持 IEEE 浮点数算术(IEC 60559),那么
- 如果实参是 ±0 或 ±∞,那么返回不修改的实参
- 如果实参是 NaN,那么返回 NaN
注解
虽然(C++ 对此函数引用的)C 标准命名此函数为“弧双曲正弦”,双曲函数的反函数却是面积函数。其实参为双曲扇形的面积,而非弧长。正确的名称是“反双曲正弦”(POSIX 所用)或“面积双曲正弦”。
额外重载不需要以 (A) 的形式提供。它们只需要能够对它们的整数类型实参 num 确保 std::asinh(num) 和 std::asinh(static_cast<double>(num)) 的效果相同。
示例
运行此代码
#include <cmath>
#include <iostream>
int main()
{
std::cout << "asinh(1) = " << std::asinh(1) << '\n'
<< "asinh(-1) = " << std::asinh(-1) << '\n';
// 特殊值
std::cout << "asinh(+0) = " << std::asinh(+0.0) << '\n'
<< "asinh(-0) = " << std::asinh(-0.0) << '\n';
}
输出:
asinh(1) = 0.881374
asinh(-1) = -0.881374
asinh(+0) = 0
asinh(-0) = -0
参阅
(C++11)(C++11)(C++11) |
计算反双曲余弦(arcosh(x)) (函数) |
(C++11)(C++11)(C++11) |
计算反双曲正切(artanh(x)) (函数) |
(C++11)(C++11) |
计算双曲正弦(sinh(x)) (函数) |
(C++11) |
计算复数的反双曲正弦(arsinh(z)) (函数模板) |
asinh 的 C 文档
| |
外部链接
Weisstein, Eric W. “反双曲正弦”来自 MathWorld--A Wolfram Web Resource。