分类整理了一下Math类的函数,与君共勉。
一.
在package java.lang.Math中
二.
有两个静态变量:1.PI 2.E, 注意是大写。
三.
方法均为静态方法:
加减乘除不建议用函数,因为只局限于int 和long
第一类:
+:addExact(int x,int y)
addExact(long x,long y)//x+y
-:subtractExact(int x,int y)
subtractExact(long x,long y)
*:multiplyExact(int x,int y)//Returns the product of the arguments, throwing an exception if the result overflows an int.
multiplyFull(int x,int y)//Returns the exact mathematical product of the arguments.这俩区别不大
multiplyExact(long x,long y)
multiplyFull(long x,long y)
/:floorDiv(int int);
floorDiv(long long