📄 math.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:35:04 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class Math</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Math.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/lang/Long.html"><B>PREV CLASS</B></A> <A HREF="../../java/lang/Number.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Math.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.lang</FONT><BR>Class Math</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<B>java.lang.Math</B></PRE><HR><DL><DT>public final class <B>Math</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A></DL><P>The class <code>Math</code> contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. <p> Unlike some of the numeric functions of class <code>StrictMath</code>, all implementations of the equivalent functions of class <code>Math</code> are not defined to return the bit-for-bit same results. This relaxation permits better-performing implementations where strict reproducibility is not required. <p> By default many of the <code>Math</code> functions simply delegate to the equivalent functions in <code>StrictMath</code> for their implementations. Code generators are encouraged to use platform-specific native libraries or microprocessor instructions, where available, to provide higher-performance implementations of <code>Math</code> functions. Such higher-performance implementations still must conform to the specification for <code>Math</code>.<P><DL><DT><B>Since: </B><DD>JDK1.0</DD></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#E">E</A></B></CODE><BR> The <code>double</code> value that is closer than any other to <code>e</code>, the base of the natural logarithms.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#PI">PI</A></B></CODE><BR> The <code>double</code> value that is closer than any other to <i>pi</i>, the ratio of the circumference of a circle to its diameter.</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#abs(double)">abs</A></B>(double a)</CODE><BR> Returns the absolute value of a <code>double</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static float</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#abs(float)">abs</A></B>(float a)</CODE><BR> Returns the absolute value of a <code>float</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#abs(int)">abs</A></B>(int a)</CODE><BR> Returns the absolute value of an <code>int</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#abs(long)">abs</A></B>(long a)</CODE><BR> Returns the absolute value of a <code>long</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#acos(double)">acos</A></B>(double a)</CODE><BR> Returns the arc cosine of an angle, in the range of 0.0 through <i>pi</i>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#asin(double)">asin</A></B>(double a)</CODE><BR> Returns the arc sine of an angle, in the range of -<i>pi</i>/2 through <i>pi</i>/2.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#atan(double)">atan</A></B>(double a)</CODE><BR> Returns the arc tangent of an angle, in the range of -<i>pi</i>/2 through <i>pi</i>/2.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#atan2(double, double)">atan2</A></B>(double a, double b)</CODE><BR> Converts rectangular coordinates (<code>b</code>, <code>a</code>) to polar (r, <i>theta</i>).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#ceil(double)">ceil</A></B>(double a)</CODE><BR> Returns the smallest (closest to negative infinity) <code>double</code> value that is not less than the argument and is equal to a mathematical integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#cos(double)">cos</A></B>(double a)</CODE><BR> Returns the trigonometric cosine of an angle.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#exp(double)">exp</A></B>(double a)</CODE><BR> Returns the exponential number <i>e</i> (i.e., 2.718...) raised to the power of a <code>double</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#floor(double)">floor</A></B>(double a)</CODE><BR> Returns the largest (closest to positive infinity) <code>double</code> value that is not greater than the argument and is equal to a mathematical integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#IEEEremainder(double, double)">IEEEremainder</A></B>(double f1, double f2)</CODE><BR> Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#log(double)">log</A></B>(double a)</CODE><BR> Returns the natural logarithm (base <i>e</i>) of a <code>double</code> value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#max(double, double)">max</A></B>(double a, double b)</CODE><BR> Returns the greater of two <code>double</code> values.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static float</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#max(float, float)">max</A></B>(float a, float b)</CODE><BR> Returns the greater of two <code>float</code> values.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#max(int, int)">max</A></B>(int a, int b)</CODE><BR> Returns the greater of two <code>int</code> values.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#max(long, long)">max</A></B>(long a, long b)</CODE><BR> Returns the greater of two <code>long</code> values.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#min(double, double)">min</A></B>(double a, double b)</CODE><BR> Returns the smaller of two <code>double</code> values.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static float</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Math.html#min(float, float)">min</A></B>(float a, float b)</CODE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -