該函數計算以弧度給出的數字的反正弦。
asin(x) = 罪-1x
用法
假設一個數字是 'x'。語法是:
float asin(float x);
double asin(double x);
long double asin(long double x);
double asin(integral x);
注意:如果傳遞的值是整數類型,則將其強製轉換為 double。
參數
x:要計算其反正弦的值
返回值
參數 | 返回值 |
---|---|
-1≤x≤1 | -∏/2,∏/2 |
x1 | 不是數字 |
例子1
當 x 的值為零時,讓我們看一個簡單的例子。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
float degree=0;
float x=degree*3.14/180;
std::cout << "Value of Sine is:" <<sin(x)<< std::endl;
cout<<"Inverse of Sine is:"<<asin(x);
return 0;
}
輸出:
Value of Sine is:0 Inverse of Sine is:0
在本例中,當 x 的值為零時,asin() 函數計算數字的反正弦。
例子2
我們來看一個簡單的例子,當 x 的值大於 1 時。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
float degree=90;
float x=degree*3.14/180;
std::cout << "Value of Sine is:" <<sin(x)<< std::endl;
cout<<"Inverse of Sine is:"<<asin(x);
return 0;
}
輸出:
Value of Sine is:1 Inverse of Sine is:nan
在本例中,當 x 的值大於 1 時,asin() 函數計算數字的反正弦。
例子3
當 x 的值小於 -1 時,讓我們看一個簡單的例子。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
float degree= -78;
float x=degree*3.14/180;
std::cout << "Value of Sine is:" <<sin(x)<< std::endl;
cout<<"Inverse of Sine is:"<<asin(x);
return 0;
}
輸出:
Value of Sine is:-0.978004 Inverse of Sine is:nan
在此示例中,當 x 的值小於 -1 時,asin() 函數計算數字的反正弦。
相關用法
- C++ Math asinh()用法及代碼示例
- C++ Math acosh()用法及代碼示例
- C++ Math atan()用法及代碼示例
- C++ Math atan2()用法及代碼示例
- C++ Math abs()用法及代碼示例
- C++ Math acos()用法及代碼示例
- C++ Math atanh()用法及代碼示例
- C++ Math scalbn()用法及代碼示例
- C++ Math isgreater()用法及代碼示例
- C++ Math fabs()用法及代碼示例
- C++ Math islessgreater()用法及代碼示例
- C++ Math log2()用法及代碼示例
- C++ Math nearbyint()用法及代碼示例
- C++ Math tan()用法及代碼示例
- C++ Math log()用法及代碼示例
- C++ Math nextafter()用法及代碼示例
- C++ Math fdim()用法及代碼示例
- C++ Math isfinite()用法及代碼示例
- C++ Math erfc()用法及代碼示例
- C++ Math sinh()用法及代碼示例
注:本文由純淨天空篩選整理自 C++ Math asin()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。