Math常用方法

2021-10-02 13:25:05 字數 457 閱讀 1041

1. abs 絕對值

2. acos,asin,atan,cos,sin,tan 三角函式

3. sqrt 平方根

4. pow(double a, double b) a的b次冪

5. max(double a, double b) 取大值

6. min(double a, double b) 取小值

7. ceil(double a) 大於a的最小整數

8. floor(double a) 小於a的最大整數

9. long round(double a) double型的資料a轉換為long型(四捨五入)

10. todegrees(double angrad) 弧度->角度

11. toradians(double angdeg) 角度->弧度

Math 常用方法

捨掉小數取整 math.floor 2 2 捨掉小數取整 math.floor 2.1 2 捨掉小數取整 math.floor 2.1 3 捨掉小數取整 math.floor 2.5 3 捨掉小數取整 math.floor 2.9 3 四捨五入取整 math.rint 2 2 四捨五入取整 math...

Math常用方法

math.abs x 函式返回指定數字 x 的絕對值 math.abs 1 1 math.abs 2 2 math.acos 1 3.141592653589793 math.ceil 函式返回大於或等於乙個給定數字的最小整數。console.log math.ceil 7.004 expected...

Math 常用方法

math.abs x 函式返回指定數字 x 的絕對 math.abs 1 1 math.abs 1 1 math.abs 1 1 math.abs str nan math.abs null 0 math.abs nanmath.ceil x 函式返回大於或等於乙個給定數字 x 的最小整數。math...