给定余弦值,返回角度
alert(Math.acos(0.5) * 180 / Math.PI); 60度
给定正弦值,返回角度
alert(Math.asin(0.5) * 180 / Math.PI); 30度
给定正切值,返回角度
alert(Math.atan(1) * 180 / Math.PI); 45度
调用方法
atan2(y , x);
参数y:点的纵坐标
参数x:点的横坐标
alert(Math.atan2(5,5) * 180 / Math.PI); 45度
给定角度,求出余弦值
alert(Math.cos(Math.PI / 3)); 0.5
给定角度,求出正弦值
alert(Math.sin(Math.PI / 6)); 0.5
给定角度,求出正切值
alert(Math.tan(Math.PI / 4)); 1
Math.exp 给定幂数,求出Math.E(2.71828) 的幂数
alert(Math.exp(5));
Math.log(num); 给定num求出以10为底,num的对数
Math.LOG2E 常量 以2为底 e的对数
Math.abs 绝对值,永远返回的是正值
Math.max 两个参数,返回其中较大的数
Math.min 两个参数,返回其中较小的数
Math.PI 常量,PI的值
Math.pow 两个参数(a,b) 返回a的b次幂
Math.random 返回(0,1)的float数
Math.ceil 返回1.2342则为2
Math.round 四舍五入的函数
Math.E e的值,常量 ,约为2.71828
Math.sqrt 求出平方根 , 小于0的时候返回NaN
Math.SQRT1_2 常量,返回0.5的开方
Math.floor 如为3.98,返回3
Math.SQRT2 常量,返回2的开方
Math.LN10 常量,以e为底,10的对数
Math.LN2 常量,以e为底,2的对数
Math.LOG10E 常量,以10为底,e的对数