- MathAbs() – 求絕對值
- MathArccos() – 求反余弦
- MathArcsin() – 求反正弦
- MathArctan() – 求反正切
- MathCeil() – 取最小整數
- MathCos() – 求余弦
- MathExp() – 求e的冪
- MathFloor() – 取最大整數
- MathLog() – 求自然對數
- MathMax() – 求最大值
- MathMin() – 求最小值
- MathMod() – 求模
- MathPow() – 求冪
- MathRand() – 獲取隨機整數
- MathRound() – 求四舍五入值
- MathSin() – 求正弦
- MathSqrt() – 求平方根
- MathSrand() – 隨機數設置
- MathTan() – 求正切
?
MathAbs() – 求絕對值
double MathAbs(double value)
返回指定數值的絕對值(模數)。
參數:
value - 數值。
示例:
double dx=-3.141593, dy; // calc MathAbs dy=MathAbs(dx); Print("The absolute value of ",dx," is ",dy); // 輸入數據: -3.141593的絕對值為3.141593
MathArccos() – 求反余弦
double MathArccos(double x)
MathArccos函數返回x在0~兀(用弧度)范圍內的反余弦。如果x小于-1或超出1,? MathArccos返回NaN(值不確定)。
參數:
x - 計算的數值在-1 到 1 之間。
示例:
double x=0.32696, y; y=MathArcsin(x); Print("正弦",x," = ",y); y=MathArccos(x); Print("余弦 ",x," = ",y); //輸出: 反正弦 0.326960=0.333085 //輸出: 反余弦 0.326960=1.237711
MathArcsin() – 求反正弦
double MathArccos(double x)
返回x在-兀/2到兀/2范圍內反正弦。如果x小于一1或超出1,返回NaN (值不確定)。
參數:
x - 計算的數值。
示例:
double x=0.32696, y; y=MathArcsin(x); Print("正弦",x," = ",y); y=MathArccos(x); Print("余弦 ",x," = ",y); //輸出: 反正弦 0.326960=0.333085 //輸出: 反余弦 0.326960=1.237711
MathArctan() – 求反正切
double MathArctan(double x)
本函數返回x的反正切值。如果x為0,返回0。返回值必須在 -兀/2 到 兀/20。
參數:
x - 計算的數值。
示例:
double x=-862.42, y; y=MathArctan(x); Print("反正切 ",x," is ",y); //輸出數據:反正切 -862.42 是 -1.5696
MathCeil() – 取最小整數
double MathCeil(double x)
MathCeil函數返回一個大于或等于x的最小整數。
參數:
x - 計算的數值。
示例:
double y; y=MathCeil(2.8); Print("上限 2.8 is ",y); y=MathCeil(-2.8); Print("上限 -2.8 is ",y); /*輸出數據: 2.8 的最小整數 3 -2.8 的最小整數 -2*/
MathCos() – 求余弦
double MathCos(double x)
返回指定角度的余弦。
參數:
x - 用弧度表示的角度值。
示例:
double pi=3.1415926535; double x, y; x=pi/2; y=MathSin(x); Print("正弦(",x,") = ",y); y=MathCos(x); Print("余弦(",x,") = ",y); //輸出數據: 正弦(1.5708)=1 // 余弦(1.5708)=0
MathExp() – 求e的冪
double MathExp(double d)
返回e的d次冪。在溢出情況下,函數返回工INF(無窮大),下溢時返回0。
參數:
d - 指定乘方的數值。
示例:
double x=2.302585093,y; y=MathExp(x); Print("MathExp(",x,") = ",y); //輸出: MathExp(2.3026)=10
MathFloor() – 取最大整數
double MathFloor(double x)
MathFloor函數返回一個小于或等于x的最大整數。
參數:
x - 計算的數值。
示例:
double y; y=MathFloor(2.8); Print("下限 2.8 is ",y); y=MathFloor(-2.8); Print("下限 -2.8 is ",y); /*輸出數據: 下限2.8 為 2 下限 -2.8 為-3*/
MathLog() – 求自然對數
double MathLog(double x)
如果成功,MathLog函數返回x的自然對數。如果x是負值,返回NaN(值不確定)。如果x是0,他們返回INF(無窮大)。
參數:
x - 計算的數值。
示例:

double x=9000.0,y; y=MathLog(x); Print("MathLog(",x,") = ", y); //輸出數據: MathLog(9000)=9.10498
來源:外匯邦
評論前必須登錄!
立即登錄 注冊