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

📄 javalang.doc10.html

📁 java语言规范
💻 HTML
📖 第 1 页 / 共 3 页
字号:
(<i>e</i> raised to the power of the argument, where <i>e</i> is the base of the natural logarithms
<a href="javalang.doc10.html#13943">(&#167;20.11.1)</a>), using the <code>exp</code> algorithm as published in <code>fdlibm</code> (see the 
introduction to this section).
<p><a name="30369"></a>
Special cases:<p>
<ul><a name="6076"></a>
<li>If the argument is NaN, then the result is NaN.
<a name="6091"></a>
<li>If the argument is positive infinity, then the result is positive infinity.
<a name="6122"></a>
<li>If the argument is negative infinity, then the result is positive zero.
</ul><a name="6123"></a>
<p><font size=+1><strong>20.11.11   </strong> <code>public static double <code><b>log</b></code>(double a)</code></font>
<p>
<a name="5981"></a>
This method computes an approximation to the natural logarithm of the argument, 
using the <code>log</code> algorithm as published in <code>fdlibm</code> (see the introduction to this section).

<p><a name="30371"></a>
Special cases:<p>
<ul><a name="6101"></a>
<li>If the argument is NaN or less than zero, then the result is NaN.
<a name="6102"></a>
<li>If the argument is positive infinity, then the result is positive infinity.
<a name="34319"></a>
<li>If the argument is positive zero or negative zero, then the result is negative infinity.
</ul><a name="34739"></a>
<p><font size=+1><strong>20.11.12   </strong> <code>public static double <code><b>sqrt</b></code>(double a)</code></font>
<p>
<a name="5985"></a>
This method computes an approximation to the square root of the argument.
<p><a name="30373"></a>
Special cases:<p>
<ul><a name="6399"></a>
<li>If the argument is NaN or less than zero, then the result is NaN.
<a name="6402"></a>
<li>If the argument is positive infinity, then the result is positive infinity.
<a name="6403"></a>
<li>If the argument is positive zero or negative zero, then the result is the same as the argument.
</ul><a name="6400"></a>
Otherwise, the result is the <code>double</code> value closest to the true mathematical square 
root of the argument value.
<p><a name="6127"></a>
<p><font size=+1><strong>20.11.13   </strong> <code>public static double <code><b>pow</b></code>(double a, double b)</code></font>
<p>
<a name="30340"></a>
This method computes an approximation to the mathematical operation of raising 
the first argument to the power of the second argument, using the <code>pow</code> algorithm as 
published in <code>fdlibm</code> (see the introduction to this section).
<p><a name="30375"></a>
Special cases:<p>
<ul><a name="6410"></a>
<li>If the second argument is positive or negative zero, then the result is <code>1.0</code>.
<a name="6433"></a>
<li>If the second argument is <code>1.0</code>, then the result is the same as the first argument.
<a name="6434"></a>
<li>If the second argument is NaN, then the result is NaN.
<a name="6435"></a>
<li>If the first argument is NaN and the second argument is nonzero, then the result is NaN.
<a name="6414"></a>
<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 &#32;1 and the second argument is negative infinity, then the result is positive infinity.
<a name="6448"></a>
<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.
<a name="6456"></a>
<li>If the absolute value of the first argument equals 1 and the second argument is infinite, then the result is NaN.
<a name="6462"></a>
<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.
<a name="6466"></a>
<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.
<a name="6475"></a>
<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.
<a name="6483"></a>
<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.
<a name="6476"></a>
<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.
<a name="6487"></a>
<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.
<a name="6576"></a>
<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.
<a name="6580"></a>
<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.
<a name="6428"></a>
<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.
<a name="6408"></a>
<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 <code>double</code> value.
</ul><a name="6586"></a>
(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 <code>ceil</code> <a href="javalang.doc10.html#13957">(&#167;20.11.15)</a> or, which is the 
same thing, a fixed point of the method <code>floor</code> <a href="javalang.doc10.html#13958">(&#167;20.11.16)</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.)
<p><a name="13956"></a>
<p><font size=+1><strong>20.11.14   </strong> <code>public static double <code><b>IEEEremainder</b></code>(double x, double y)</code></font>
<p>
<a name="6638"></a>
This method computes the remainder operation on two arguments as prescribed 
by the IEEE 754 standard: the remainder value is mathematically equal to 
<img src="javalang.doc.anc11.gif"> where <img src="javalang.doc.anc12.gif"> is the mathematical integer closest to the exact mathematical 
value of the quotient <img src="javalang.doc.anc13.gif">; if two mathematical integers are equally close to <img src="javalang.doc.anc14.gif"> 
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.
<p><a name="30376"></a>
Special cases:<p>
<ul><a name="6662"></a>
<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.
<a name="6667"></a>
<li>If the first argument is finite and the second argument is infinite, then the result is the same as the first argument.
</ul><a name="13957"></a>
<p><font size=+1><strong>20.11.15   </strong> <code>public static double <code><b>ceil</b></code>(double a)</code></font>
<p>
<a name="6622"></a>
The result is the smallest (closest to negative infinity) <code>double</code> value that is not less 
than the argument and is equal to a mathematical integer.
<p><a name="30378"></a>
Special cases:<p>
<ul><a name="6623"></a>
<li>If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
<a name="6606"></a>
<li>If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
<a name="30381"></a>
<li>If the argument value is less than zero but greater than <code>-1.0</code>, then the result is negative zero.
</ul><a name="30565"></a>
Note that the value of <code>Math.ceil(x)</code> is exactly the value of <code>-Math.floor(-x)</code>.
<p><a name="13958"></a>
<p><font size=+1><strong>20.11.16   </strong> <code>public static double <code><b>floor</b></code>(double a)</code></font>
<p>
<a name="6625"></a>
The result is the largest (closest to positive infinity) <code>double</code> value that is not 
greater than the argument and is equal to a mathematical integer.
<p><a name="30380"></a>
Special cases:<p>
<ul><a name="6626"></a>
<li>If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
<a name="6610"></a>
<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><a name="13959"></a>
<p><font size=+1><strong>20.11.17   </strong> <code>public static double <code><b>rint</b></code>(double a)</code></font>
<p>
<a name="7052"></a>
The result is the <code>double</code> value that is closest in value to the argument 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.
<p><a name="30553"></a>
Special cases:<p>
<ul><a name="7066"></a>
<li>If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
<a name="7067"></a>
<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><a name="13963"></a>
<p><font size=+1><strong>20.11.18   </strong> <code>public static int <code><b>round</b></code>(float a)</code></font>
<p>
<a name="6922"></a>
The result is rounded to an integer by adding <img src="javalang.doc.anc30.gif">, taking the floor of the result, 
and casting the result to type <code>int</code>.
<p><a name="6927"></a>
In other words, the result is equal to the value of the expression:<p>
<pre><a name="6928"></a>(int)Math.floor(a + 0.5f)
</pre><a name="30555"></a>
Special cases:<p>
<ul><a name="6935"></a>
<li>If the argument is NaN, the result is <code>0</code>.
<a name="6979"></a>
<li>If the argument is negative infinity, or indeed any value less than or equal to the value of <code>Integer.MIN_VALUE</code> <a href="javalang.doc6.html#2390">(&#167;20.7.1)</a>, the result is equal to the value of <code>Integer.MIN_VALUE</code>.
<a name="6936"></a>
<li>If the argument is positive infinity, or indeed any value greater than or equal to the value of <code>Integer.MAX_VALUE</code> <a href="javalang.doc6.html#2391">(&#167;20.7.2)</a>, the result is equal to the value of <code>Integer.MAX_VALUE</code>.
</ul><a name="13964"></a>
<p><font size=+1><strong>20.11.19   </strong> <code>public static long <code><b>round</b></code>(double a)</code></font>
<p>
<a name="6989"></a>
The result is rounded to an integer by adding <img src="javalang.doc.anc31.gif">, taking the floor of the result, 
and casting the result to type <code>long</code>.
<p><a name="6990"></a>
In other words, the result is equal to the value of the expression:<p>
<pre><a name="6991"></a>(long)Math.floor(a + 0.5d)
</pre><a name="30557"></a>

⌨️ 快捷键说明

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