Math.PI 记录的圆周率 PI = 3.141592653589793;
Math.E 记录e的常量 E = 2.718281828459045;
/**
* Returns the absolute value of the argument.
* <p>
* Special cases:
* <ul>
* <li>{@code abs(-0.0) = +0.0}</li>
* <li>{@code abs(+infinity) = +infinity}</li>
* <li>{@code abs(-infinity) = +infinity}</li>
* <li>{@code abs(NaN) = NaN}</li>
* </ul>
*/
Math.abs() 求绝对值
/**
* Returns the closest double approximation of the sine of the argument. The
* returned result is within 1 ulp (unit in the last place) of the real
* result.
* <p>
* Special cases:
* <ul>
* <li>{@code sin(+0.0) = +0.0}</li>
* <li>{@code sin(-0.0) = -0.0}</li>
* <li>{@code sin(+infinity) = NaN}</li>
* <li>{@code sin(-infinity) = NaN}</li>
* <li>{@code sin(NaN) = NaN}</li>
* </ul>
*
* @param d
* the angle whose sin has to be computed, in radians.
* @return the sine of the argument.
*/
Math.sin() 正弦函数
/**
* Returns the closest double approximation of the arc sine of the argument
* within the range {@code [-pi/2..pi/2]}. The returned result is within 1
* ulp (unit in the last place) of the real result.
* <p>
* Special cases:
* <ul>
* <li>{@code asin((anything > 1)) = NaN}</li>
* <li>{@code asin((anything < -1)) = NaN}</li>
* <li>{@code asin(NaN) = NaN}</li>
* </ul>
*
* @param d
* the value whose arc sine has to be computed.
* @return the arc sine of the argument.
*/
Math.asin()反正弦函数
Math.cos()余弦函数
Math.acos()反余弦函数
Math.tan()正切函数
Math.atan()反正切函数
Math.atan2()商的反正切函数
Math.toDegrees()弧度转换为角度
Math.toRadians()角度转化为弧度
Math.ceil()得到不小于某数的最大整数
Math.floor()得到不小于某数的最大值
例如: Math.floor(12.7)=12.0
Math.ceil(12.7)=13.0
ceil()是天花板,即向上取值,floor()是地板,向下取值。round()是四舍五入
Math.IEEEremaiinder()求余
Math.maz()求两个数最大值
Math.min()求两个数最小值
Math.sqrt()求开方
Math.pow()求某数的任意次方,抛出ArithmeticExction处理溢出的异常
Math.sqrt(x)平方根
Math.pow(x,y):x的y次方
Math.exp()求e的任意次方
Math.log10 求以10为底的对数
Math.log()求自然对数
Math.rint() 求距离某数最近的整数(可能比某数大,也可能比它小)
Math.round() 四舍五入
Math.random()返回(0,1)之间的一个随机数
BigInteger bi1=new BigInteger(“12345678901234567890”);
BigInteger bi2=BigInteger.valueOf(123L)
bi1=bil1.add(bi2);//b1+b2;
bi1=bi1.multiply(bi2);//b1*b2;
bi1=bi1.subtract(bi2);//b1-b2;
bil1=bi1.divide(bi2);//b1/b2;
java.math.BigDecimal(大浮点数)
BigDecimal bd=new BigDecimal(“3.1415926”);
bg=bd.setScale(2,BigDeciamal.ROUND_DOWN);取3.1415926小数点后面两位