当前位置: 首页 > 图文教程 > 网络编程 > Javascript > Javascript中的数学函数集合

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript中的数学函数集合


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 58 ::
收藏到网摘: n/a

在Javascript中,数学方法可以分成以下几类:
constans(常数)、power functions(乘方函数)、trigonometic functions(三角函数)、rounding functions(舍入函数)、random numbers(随机数字)

引用
常数和乘方函数
Math.E 自然对数的底(为常数) 2.718
Math.LN10 10的自然对数 2.302
Math.LN2 2的自然对数 0.693
Math.PI 圆周率 3.1415
Math.SQRT1_2 1/2的平方根 0.707
Math.SQRT2 2的平方根 1.414
Math.sqrt(x) X的平方根 更X的值有关
Math.pow(x, n) 返回x的n次方的数值 参数为x和n
Math.log(n) 返回n的自然对数 参数为n
Math.exp(n) 返回e的n次方的数值 参数为n
三角函数
Math.cos(x) X的余弦函数
Math.sin(x) X的正弦函数
Math.tan(x) X的正切函数
Math.acos(y) X的反余弦函数
Math.asin(y) X的反正弦函数
Math.atan(y) X的反正切函数
这里注意:参数x和以及反函数的返回数值的单位都为弧度(比如 PI弧度=180度)
舍入函数和随机数字
Math.random() 产生从0到1的随机数
Math.round(x) 取最接近整数x的数值
Math.floor(x) 取最接近整数x并且比x小的数值
Math.ceil(x) 取最接近整数x并且比x大的数值
Math.min(a, b, c) 返回参数列表中最小的数值
Math.max(a, b, c) 返回参数列表中最大的数值

原文:http://www.cnlei.org/blog/article.asp?id=408