⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 math.html

📁 javascript 1.5规范
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<HTML><HEAD>        <META NAME="keywords" CONTENT="electronic commerce, ecommerce, ebusiness, e-business, e-commerce, enterprise software, net economy, Netscape, Sun Microsystems, Sun-Netscape Alliance, iPlanet, internet software">        <META NAME="description" CONTENT="The Sun-Netscape Alliance, a strategic alliance formed by America Online and Sun Microsystems, Inc., is delivering iPlanet e-commerce software and enterprise solutions that enable companies to compete successfully in the Net Economy">	<META HTTP-EQUIV="Content-Type" content="text/html; charset=ISO-8859-1">	<META NAME="TEMPLATEBASE" CONTENT="Authored in FrameMaker. Converted to HTML in WebWorks Publisher 2000. manual wdt 1.5">	<META NAME="LASTUPDATED" CONTENT="09/28/00 13:15:36">	<TITLE> Core JavaScript Reference 1.5:  </TITLE></HEAD><BODY TEXT="#000000" LINK="#666699" VLINK="#666699" ALINK="#333366" BGCOLOR="#FFFFFF"><MAINCONTENT><NAVIGATIONCONTENT>   <TABLE WIDTH="100%" BORDER="0" CELLSPACING="4">      <TR>         <TD VALIGN="TOP">            <b><a href="javpkg.html"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#993300">Previous</a></FONT>&nbsp;&nbsp;&nbsp;&nbsp;</b><a href="contents.html"><b><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#993300">Contents</a></FONT></b>&nbsp;&nbsp;&nbsp;&nbsp;<a href="ix.html"><b><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#993300">Index</a></FONT></b>&nbsp;&nbsp;&nbsp;&nbsp;<a href="netscape.html"><b><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#993300">Next</a></FONT></b>&nbsp;&nbsp;&nbsp;&nbsp;         </TD>     </TR>      <TR>         <TD VALIGN="TOP" ALIGN="RIGHT" BGCOLOR="#CCCCCC">            <FONT FACE="Arial, Helvetica, sans-serif" COLOR="#000000" SIZE="2"><B>             Core JavaScript Reference 1.5</B></FONT>         </TD>      </TR>      <TR>   </TABLE>   <BR></NAVIGATIONCONTENT><BOOKCONTENT>   <blockquote><BR><BR>      <BR><BR><P><A NAME="1193138"> </A><A NAME="Math"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="5"><B><zrefhead1>Math</zrefhead1></B></FONT><P><A NAME="1193139"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>A built-in object that has properties and methods for mathematical constants and functions. For example, the <FONT FACE="courier, couriernew, monospaced size">Math</FONT> object's <A HREF="math.html#1193490"  >PI</A> property has the value of pi.<BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0">  <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR>  <TR>    <TD VALIGN=TOP COLSPAN=2 ROWSPAN=1><P><A NAME="1193145"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Core object</I></ztabletext></FONT></TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1193149"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Implemented in</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193151"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>JavaScript 1.0, NES 2.0</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1201615"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>ECMA version</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1201617"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>ECMA-262</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1193152"> </A><A NAME="Created by"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Created by</zrefheader></B></FONT><BR><A NAME="1193156"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>The <A HREF="math.html#1193138"  >Math</A> object is a top-level, predefined JavaScript object. You can automatically access it without using a constructor or calling a method.</zparagraph></FONT><P><BR><A NAME="1193157"> </A><A NAME="Description"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Description</zrefheader></B></FONT><BR><A NAME="1193158"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>All properties and methods of <FONT FACE="courier, couriernew, monospaced size">Math</FONT> are static. You refer to the constant PI as <FONT FACE="courier, couriernew, monospaced size">Math.PI</FONT> and you call the sine function as <FONT FACE="courier, couriernew, monospaced size">Math.sin(x)</FONT>, where <FONT FACE="courier, couriernew, monospaced size">x</FONT> is the method's argument. Constants are defined with the full precision of real numbers in JavaScript. </zparagraph></FONT><P><A NAME="1193162"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>It is often convenient to use the <A HREF="stmt.html#1004910"  >with</A> statement when a section of code uses several <FONT FACE="courier, couriernew, monospaced size">Math</FONT> constants and methods, so you don't have to type "Math" repeatedly. For example,</zparagraph></FONT><P><A NAME="1193163"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>with (Math) {<br>&nbsp;&nbsp;&nbsp;a = PI * r*r<br>&nbsp;&nbsp;&nbsp;y = r*sin(theta)<br>&nbsp;&nbsp;&nbsp;x = r*cos(theta)<br>}</zcodeline></FONT><P><BR><A NAME="1193164"> </A><A NAME="Property Summary"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Property Summary</zrefheader></B></FONT><BR><A NAME="1193226"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0">  <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR>  <TR BGCOLOR="#CCCCCC" ALIGN=LEFT VALIGN=TOP>    <TH VALIGN=TOP ALIGN=LEFT><A NAME="1193167"> </A><P ALIGN="LEFT"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><ztablehead>Property</ztablehead></B></FONT></TH>    <TH VALIGN=TOP ALIGN=LEFT><A NAME="1193169"> </A><P ALIGN="LEFT"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><ztablehead>Description</ztablehead></B></FONT></TH>  </DIV></TR>  <TR>    <TD VALIGN=TOP><A NAME="1193174"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1193363"  >E</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193176"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Euler's constant and the base of natural logarithms, approximately 2.718.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1216179"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1216604"  >LN2</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1216181"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Natural logarithm of 2, approximately 0.693.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193181"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1193389"  >LN10</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193183"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Natural logarithm of 10, approximately 2.302.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1216068"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1193465"  >LOG2E</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1216070"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Base 2 logarithm of E (approximately 1.442).</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193195"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1217093"  >LOG10E</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193197"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Base 10 logarithm of E (approximately 0.434).</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193209"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1193490"  >PI</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193211"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Ratio of the circumference of a circle to its diameter, approximately 3.14159.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193216"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1193515"  >SQRT1_2</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193218"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193223"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1193540"  >SQRT2</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193225"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Square root of 2, approximately 1.414.</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1193227"> </A><A NAME="Method Summary"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Method Summary</zrefheader></B></FONT><BR><A NAME="1193359"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0">  <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR>  <TR BGCOLOR="#CCCCCC" ALIGN=LEFT VALIGN=TOP>    <TH VALIGN=TOP ALIGN=LEFT><A NAME="1193230"> </A><P ALIGN="LEFT"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><ztablehead>Method</ztablehead></B></FONT></TH>    <TH VALIGN=TOP ALIGN=LEFT><A NAME="1193232"> </A><P ALIGN="LEFT"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><ztablehead>Description</ztablehead></B></FONT></TH>  </DIV></TR>  <TR>    <TD VALIGN=TOP><A NAME="1193237"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1195395"  >abs</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193239"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the absolute value of a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193244"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1195429"  >acos</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193246"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the arccosine (in radians) of a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193251"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1195485"  >asin</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193253"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the arcsine (in radians) of a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193258"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1195541"  >atan</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193260"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the arctangent (in radians) of a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193265"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1195597"  >atan2</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193267"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the arctangent of the quotient of its arguments. </ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193272"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1195654"  >ceil</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193274"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the smallest integer greater than or equal to a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193279"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1195695"  >cos</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193281"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the cosine of a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193286"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1196408"  >exp</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193288"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns E<SUP>number</SUP>, where <FONT FACE="courier, couriernew, monospaced size">number</FONT> is the argument, and E is Euler's constant, the base of the natural logarithms.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193293"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1196455"  >floor</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193295"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the largest integer less than or equal to a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193300"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1196917"  >log</A>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -