📄 strictmath.html
字号:
<ul><li>If the argument is NaN, the result is NaN. <li>If the argument is positive infinity, then the result is positive infinity. <li>If the argument is negative infinity, then the result is positive zero.</ul><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a <code>double</code> value.<DT><B>Returns:</B><DD>the value <i>e</i><sup>a</sup>, where <i>e</i> is the base of the natural logarithms.</DL></DD></DL><HR><A NAME="log(double)"><!-- --></A><H3>log</H3><PRE>public static double <B>log</B>(double a)</PRE><DL><DD>Returns the natural logarithm (base <i>e</i>) of a <code>double</code> value. Special cases: <ul><li>If the argument is NaN or less than zero, then the result is NaN. <li>If the argument is positive infinity, then the result is positive infinity. <li>If the argument is positive zero or negative zero, then the result is negative infinity.</ul><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a number greater than <code>0.0</code>.<DT><B>Returns:</B><DD>the value ln <code>a</code>, the natural logarithm of <code>a</code>.</DL></DD></DL><HR><A NAME="sqrt(double)"><!-- --></A><H3>sqrt</H3><PRE>public static double <B>sqrt</B>(double a)</PRE><DL><DD>Returns the positive square root of a <code>double</code> value. Special cases: <ul><li>If the argument is NaN or less than zero, then the result is NaN. <li>If the argument is positive infinity, then the result is positive infinity. <li>If the argument is positive zero or negative zero, then the result is the same as the argument.</ul> Otherwise, the result is the <code>double</code> value closest to the true mathetmatical square root of the argument value.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a <code>double</code> value. <!--@return the value of √ <code>a</code>.--><DT><B>Returns:</B><DD>the positive square root of <code>a</code>.</DL></DD></DL><HR><A NAME="IEEEremainder(double, double)"><!-- --></A><H3>IEEEremainder</H3><PRE>public static double <B>IEEEremainder</B>(double f1, double f2)</PRE><DL><DD>Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. The remainder value is mathematically equal to <code>f1 - f2</code> × <i>n</i>, where <i>n</i> is the mathematical integer closest to the exact mathematical value of the quotient <code>f1/f2</code>, and if two mathematical integers are equally close to <code>f1/f2</code>, then <i>n</i> is the integer that is even. If the remainder is zero, its sign is the same as the sign of the first argument. Special cases: <ul><li>If either argument is NaN, or the first argument is infinite, or the second argument is positive zero or negative zero, then the result is NaN. <li>If the first argument is finite and the second argument is infinite, then the result is the same as the first argument.</ul><DD><DL><DT><B>Parameters:</B><DD><CODE>f1</CODE> - the dividend.<DD><CODE>f2</CODE> - the divisor.<DT><B>Returns:</B><DD>the remainder when <code>f1</code> is divided by <code>f2</code>.</DL></DD></DL><HR><A NAME="ceil(double)"><!-- --></A><H3>ceil</H3><PRE>public static double <B>ceil</B>(double a)</PRE><DL><DD>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. Special cases: <ul><li>If the argument value is already equal to a mathematical integer, then the result is the same as the argument. <li>If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument. <li>If the argument value is less than zero but greater than -1.0, then the result is negative zero.</ul> Note that the value of <code>Math.ceil(x)</code> is exactly the value of <code>-Math.floor(-x)</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a <code>double</code> value. <!--@return the value ⌈ <code>a</code> ⌉.--><DT><B>Returns:</B><DD>the smallest (closest to negative infinity) <code>double</code> value that is not less than the argument and is equal to a mathematical integer.</DL></DD></DL><HR><A NAME="floor(double)"><!-- --></A><H3>floor</H3><PRE>public static double <B>floor</B>(double a)</PRE><DL><DD>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. Special cases: <ul><li>If the argument value is already equal to a mathematical integer, then the result is the same as the argument. <li>If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.</ul><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a <code>double</code> value. <!--@return the value ⌊ <code>a</code> ⌋.--><DT><B>Returns:</B><DD>the largest (closest to positive infinity) <code>double</code> value that is not greater than the argument and is equal to a mathematical integer.</DL></DD></DL><HR><A NAME="rint(double)"><!-- --></A><H3>rint</H3><PRE>public static double <B>rint</B>(double a)</PRE><DL><DD>Returns the <code>double</code> value that is closest in value to <code>a</code> and is equal to a mathematical integer. If two <code>double</code> values that are mathematical integers are equally close to the value of the argument, the result is the integer value that is even. Special cases: <ul><li>If the argument value is already equal to a mathematical integer, then the result is the same as the argument. <li>If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.</ul><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a <code>double</code> value.<DT><B>Returns:</B><DD>the closest <code>double</code> value to <code>a</code> that is equal to a mathematical integer.</DL></DD></DL><HR><A NAME="atan2(double, double)"><!-- --></A><H3>atan2</H3><PRE>public static double <B>atan2</B>(double a, double b)</PRE><DL><DD>Converts rectangular coordinates (<code>b</code>, <code>a</code>) to polar (r, <i>theta</i>). This method computes the phase <i>theta</i> by computing an arc tangent of <code>a/b</code> in the range of -<i>pi</i> to <i>pi</i>. Special cases: <ul><li>If either argument is NaN, then the result is NaN. <li>If the first argument is positive zero and the second argument is positive, or the first argument is positive and finite and the second argument is positive infinity, then the result is positive zero. <li>If the first argument is negative zero and the second argument is positive, or the first argument is negative and finite and the second argument is positive infinity, then the result is negative zero. <li>If the first argument is positive zero and the second argument is negative, or the first argument is positive and finite and the second argument is negative infinity, then the result is the <code>double</code> value closest to pi. <li>If the first argument is negative zero and the second argument is negative, or the first argument is negative and finite and the second argument is negative infinity, then the result is the <code>double</code> value closest to -pi. <li>If the first argument is positive and the second argument is positive zero or negative zero, or the first argument is positive infinity and the second argument is finite, then the result is the <code>double</code> value closest to pi/2. <li>If the first argument is negative and the second argument is positive zero or negative zero, or the first argument is negative infinity and the second argument is finite, then the result is the <code>double</code> value closest to -pi/2. <li>If both arguments are positive infinity, then the result is the <code>double</code> value closest to pi/4. <li>If the first argument is positive infinity and the second argument is negative infinity, then the result is the <code>double</code> value closest to 3*pi/4. <li>If the first argument is negative infinity and the second argument is positive infinity, then the result is the <code>double</code> value closest to -pi/4. <li>If both arguments are negative infinity, then the result is the <code>double</code> value closest to -3*pi/4.</ul><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a <code>double</code> value.<DD><CODE>b</CODE> - a <code>double</code> value.<DT><B>Returns:</B><DD>the <i>theta</i> component of the point (<i>r</i>, <i>theta</i>) in polar coordinates that corresponds to the point (<i>b</i>, <i>a</i>) in Cartesian coordinates.</DL></DD></DL><HR><A NAME="pow(double, double)"><!-- --></A><H3>pow</H3><PRE>public static double <B>pow</B>(double a, double b)</PRE><DL><DD>Returns of value of the first argument raised to the power of the second argument. Special cases: <ul><li>If the second argument is positive or negative zero, then the result is 1.0. <li>If the second argument is 1.0, then the result is the same as the first argument. <li>If the second argument is NaN, then the result is NaN. <li>If the first argument is NaN and the second argument is nonzero, then the result is NaN. <li>If the absolute value of the first argument is greater than 1 and the second argument is positive infinity, or the absolute value of the first argument is less than 1 and the second argument is negative infinity, then the result is positive infinity. <li>If the absolute value of the first argument is greater than 1 and the second argument is negative infinity, or the absolute value of the first argument is less than 1 and the second argument is positive infinity, then the result is positive zero. <li>If the absolute value of the first argument equals 1 and the second argument is infinite, then the result is NaN. <li>If the first argument is positive zero and the second argument is greater than zero, or the first argument is positive infinity and the second argument is less than zero, then the result is positive zero. <li>If the first argument is positive zero and the second argument is less than zero, or the first argument is positive infinity and the second argument is greater than zero, then the result is positive infinity. <li>If the first argument is negative zero and the second argument is greater than zero but not a finite odd integer, or the first argument is negative infinity and the second argument is less than zero but not a finite odd integer, then the result is positive zero. <li>If the first argument is negative zero and the second argument is a positive finite odd integer, or the first argument is negative infinity and the second argument is a negative finite odd integer, then the result is negative zero. <li>If the first argument is negative zero and the second argument is less than zero but not a finite odd integer, or the first argument is negative infinity and the second argument is greater than zero but not a finite odd integer, then the result is positive infinity. <li>If the first argument is negative zero and the second argument is a negative finite odd integer, or the first argument is negative infinity and the second argument is a positive finite odd integer, then the result is negative infinity. <li>If the first argument is less than zero and the second argument is a finite even integer, then the result is equal to the result of raising the absolute value of the first argument to the power of the second argument. <li>If the first argument is less than zero and the second argument is a finite odd integer, then the result is equal to the negative of the result of raising the absolute value of the first argument to the power of the second argument. <li>If the first argument is finite and less than zero and the second argument is finite and not an integer, then the result is NaN. <li>If both arguments are integers, then the result is exactly equal to the mathematical result of raising the first argument to the power of the second argument if that result can in fact be represented exactly as a double value.</ul> <p>(In the foregoing descriptions, a floating-point value is considered to be an integer if and only if it is a fixed point of the method <A HREF="../../java/lang/StrictMath.html#ceil(double)"><CODE><tt>ceil</tt></CODE></A> or, which is the same thing, a fixed point of the method <A HREF="../../java/lang/StrictMath.html#floor(double)"><CODE><tt>floor</tt></CODE></A>. A value is a fixed point of a one-argument method if and only if the result of applying the method to the value is equal to the value.)<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a <code>double</code> value.<DD><CODE>b</CODE> - a <code>double</code> value.<DT><B>Returns:</B><DD>the value <code>a<sup>b</sup></code>.</DL></DD></DL><HR><A NAME="round(float)"><!-- --></A><H3>round</H3><PRE>public static int <B>round</B>(float a)</PRE><DL><DD>Returns the closest <code>int</code> to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type <code>int</code>. In other words, the result is equal to the value of the expression: <p><pre>(int)Math.floor(a + 0.5f)</pre> <p> Special cases: <ul><li>If the argument is NaN, the result is 0. <li>If the argument is negative infinity or any value less than or equal to the value of <code>Integer.MIN_VALUE</code>, the result is equal to the value of <code>Integer.MIN_VALUE</code>. <li>If the argument is positive infinity or any value greater than or equal to the value of <code>Integer.MAX_VALUE</code>, the result is equal to the value of <code>Integer.MAX_VALUE</code>.</ul><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a <code>float</code> value.<DT><B>Returns:</B><DD>the value of the argument rounded to the nearest <code>int</code> value.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Integer.html#MAX_VALUE"><CODE>Integer.MAX_VALUE</CODE></A>, <A HREF="../../java/lang/Integer.html#MIN_VALUE"><CODE>Integer.MIN_VALUE</CODE></A></DL></DD></DL><HR><A NAME="round(double)"><!-- --></A><H3>round</H3><PRE>public static long <B>round</B>(double a)</PRE><DL><DD>Returns the closest <code>long</code> to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type <code>long</code>. In other words, the result is equal to the value of the expression:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -