asinh()是C++ STL中的內置函數,它返回以弧度給出的角度的反雙曲正弦值。
用法:
asinh(data_type x)
參數:該函數接受一個強製性參數x,該參數以弧度指定反雙曲角。它可以是任何值,即負,正或零。該參數可以是double,float或long double數據類型。
返回值:此函數以弧度返回參數的反雙曲正弦值。
下麵的程序演示了上述函數:
示例1:
// C++ program to demonstrate
// the asinh() function
#include <bits/stdc++.h>
using namespace std;
int main()
{
double x = 50.0;
// Function call to calculate asinh(x) value
double result = asinh(x);
cout << "asinh(50.0) = " << result << " radians" << endl;
cout << "asinh(50.0) = " << result * 180 / 3.141592
<< " degrees" << endl;
return 0;
}
輸出:
asinh(50.0) = 4.60527 radians asinh(50.0) = 263.863 degrees
示例2:
// C++ program to demonstrate
// the asinh() function
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x = -50.0;
// Function call to calculate asinh(x) value
double result = asinh(x);
cout << "asinh(-50.0) = " << result << " radians" << endl;
cout << "asinh(-50.0) = " << result * 180 / 3.141592
<< " degrees" << endl;
return 0;
}
輸出:
asinh(-50.0) = -4.60527 radians asinh(-50.0) = -263.863 degrees
錯誤和異常:當字符串或字符作為參數傳遞時,該函數不返回任何匹配函數來調用錯誤。
示例3:
// C++ program to demonstrate
// the asinh() function
#include <bits/stdc++.h>
using namespace std;
int main()
{
string x = "gfg";
// Function call to calculate asinh(x) value
double result = asinh(x);
cout << "asinh(50.0) = " << result << " radians" << endl;
cout << "asinh(50.0) = " << result * 180 / 3.141592
<< " degrees" << endl;
return 0;
}
輸出:
prog.cpp:11:25: error: no matching function for call to 'asinh(std::__cxx11::string&)' double result = asinh(x);
相關用法
- C++ complex asinh()用法及代碼示例
- C++ div()用法及代碼示例
- C++ fma()用法及代碼示例
- C++ log()用法及代碼示例
- C++ regex_iterator()用法及代碼示例
- C++ valarray exp()用法及代碼示例
- C++ valarray sin()用法及代碼示例
- C++ valarray abs()用法及代碼示例
- C++ valarray end()用法及代碼示例
- C++ map rbegin()用法及代碼示例
- C++ valarray cos()用法及代碼示例
- C++ valarray log()用法及代碼示例
注:本文由純淨天空篩選整理自pawan_asipu大神的英文原創作品 asinh() function in C++ STL。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。