- sin(radians) 返回以弧度为单位的角度的三角正弦函数值
- cos(radians) 返回以弧度为单位的角度的三角余弦函数值
- tan(radians) 返回以弧度为单位的角度的三角正切函数值
- toRadians(degree) 将以度为单位的角度值转换为以弧度表示
- toDegrees(radians) 将以弧度为单位的角度值转换为以度表示
- asin(a) 返回以弧度为单位的角度的反三角正弦函数值
- acos(a) 返回以弧度为单位的角度的反三角余弦函数值
- atan(a) 返回以弧度为单位的角度的反三角正切函数值
Math 类还提供了两 个很有用的 double 型常量,PI ( TT ) 和 E (自然对数的底)。可以在任意程序中用Math.PI 和 Math.E 的形式来使用这两个常量。
Math.toDegrees(Math.PI / 2) 返回 90.0
Math.toRadians(30)返回 0.5236 (n/6)
Math.sin(0) returns 0.0
Math.sin(Math.toRadians(270)) 返回-1.0
Math.sin(Math.PI / 6) 返回 0.S
Math.sin(Math.PI / 2)返回 1.0
Math.cos(0) 返回 1.0
Math.cos(Math.PI / 6) 返回 0.866
Math.cos(Math.PI / 2) 返回 0
Math.asin(0.5)返回0. S23S98333 (π/6)
Math.acos(0.5) 返回 1.0472 (π/3)
Math.atan(1.0) 返回 0.78S398 (π/4)
指数函数:
取整函数:
Math.ceil(2.1) 返回3.0
Math.ceil(2.0) 返回2.0
Math.ceil(-2.0)返回 -2.0
Math.ceil(-2.1) 返回-2.0
Math.floor(2.1) 返回2.0
Math.floor(2.0) 返回2.0
Math.floor(-2.0) 返回-2.0
Math.floor(-2.1) 返回-3.0
Math.rint(2.1)返回 2.0
Math.rint(-2.0) 返回-2.0
Math.rint(-2.1) 返回-2.0
Math.rint(2.5) 返回2.0
Math.rint(4.5) 返回4.0
Math.rint(-2.5) 返回-2.0
Math.round(2.6f) 返回3 // Returns int
Math.round(2.0) 返回2 // Returns long
Math.round(-2.0f) 返回-2 // Returns int
Math.round(-2.6) 返回-3 // Returns long
Math.round(-2.4) 返回-2 // Returns long