instructions2.doc4.html

来自「Java编程规范」· HTML 代码 · 共 735 行 · 第 1/3 页

HTML
735
字号
The Java virtual machine requires support of gradual underflow as defined by IEEE 754. Despite the fact that overflow, underflow, or loss of precision may occur, execution of an <i>fmul</i> instruction never throws a runtime exception.</blockquote><p><a name="fneg"></a><hr><h2>fneg</h2><a name="fneg.Operation"></a><p><b>Operation</b><br><blockquote><a name="68108"></a>Negate <code>float</code><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68107"></a> <i>fneg</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="fneg.Forms"></a><p><b>Forms</b><br><blockquote><a name="68109"></a><i>fneg</i> = 118 (0x76)</blockquote><p><a name="fneg.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68110"></a>..., <i>value</i><em> </em><img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="fneg.Description"></a><p><b>Description</b><br><blockquote><a name="68111"></a>The <i>value</i> must be of type <code>float</code>. It is popped from the operand stack and undergoes value set conversion <a href="Overview.doc.html#33120">(&#167;3.8.3)</a>, resulting in <i>value'</i>. The <code>float</code> <i>result</i> is the arithmetic negation of <i>value'</i>. This <i>result</i> is pushed onto the operand stack.</blockquote><p><blockquote><a name="68112"></a>For <code>float</code> values, negation is not the same as subtraction from zero. If <code>x</code> is +<code>0.0</code>, then <code>0.0</code>-<code>x</code> equals +<code>0.0</code>, but -<code>x</code> equals -<code>0.0</code>. Unary minus merely inverts the sign of a <code>float</code>. </blockquote><p><blockquote><a name="68113"></a>Special cases of interest:</blockquote><p><ul><li>If the operand is NaN, the result is NaN (recall that NaN has no sign).<p><li>If the operand is an infinity, the result is the infinity of opposite sign.<p><li>If the operand is a zero, the result is the zero of opposite sign.</ul><a name="frem"></a><hr><h2>frem</h2><a name="frem.Operation"></a><p><b>Operation</b><br><blockquote><a name="68126"></a>Remainder <code>float</code><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68125"></a> <i>frem</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="frem.Forms"></a><p><b>Forms</b><br><blockquote><a name="68127"></a><i>frem</i> = 114 (0x72)</blockquote><p><a name="frem.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68128"></a>..., <i>value1</i><em>, </em><i>value2</i> <img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="frem.Description"></a><p><b>Description</b><br><blockquote><a name="68129"></a>Both <i>value1</i> and <i>value2</i> must be of type <code>float</code>. The values are popped from the operand stack and undergo value set conversion <a href="Overview.doc.html#33120">(&#167;3.8.3)</a>, resulting in <i>value1'</i> and <i>value2'</i>. The <i>result</i> is calculated and pushed onto the operand stack as a <code>float</code>.</blockquote><p><blockquote><a name="68130"></a>The <i>result</i> of an <i>frem</i> instruction is not the same as that of the so-called remainder operation defined by IEEE 754. The IEEE 754 "remainder" operation computes the remainder from a rounding division, not a truncating division, and so its behavior is <i>not</i> analogous to that of the usual integer remainder operator. Instead, the Java virtual machine defines <i>frem</i> to behave in a manner analogous to that of the Java virtual machine integer remainder instructions (<i>irem</i> and <i>lrem</i>); this may be compared with the C library function <code>fmod</code>.</blockquote><p><blockquote><a name="68134"></a>The result of an <i>frem</i> instruction is governed by these rules:</blockquote><p><ul><li>If either <i>value1'</i> or <i>value2'</i> is NaN, the result is NaN.<p><li>If neither <i>value1'</i> nor <i>value2'</i> is NaN, the sign of the result equals the sign of the dividend.<p><li>If the dividend is an infinity or the divisor is a zero or both, the result is NaN.<p><li>If the dividend is finite and the divisor is an infinity, the result equals the dividend.</ul><ul><li>If the dividend is a zero and the divisor is finite, the result equals the dividend.<p><li>In the remaining cases, where neither operand is an infinity, a zero, or NaN, the floating-point remainder <i>result</i><i> </i>from a dividend <i>value1'</i> and a divisor <i>value2'</i> is defined by the mathematical  relation <i>result </i>=<i> value1' </i>-<i> </i>(<i>value2' </i>*<i> q</i>), where <i>q</i> is an integer that is negative only if <i>value1' </i>/<i> value2' </i>is negative and positive only if <i>value1' </i>/<i> value2' </i>is positive, and whose magnitude is as large  as possible without exceeding the magnitude of the true mathematical quotient of <i>value1'</i> and <i>value2'</i>.</ul><blockquote><a name="68150"></a>Despite the fact that division by zero may occur, evaluation of an <i>frem</i> instruction never throws a runtime exception. Overflow, underflow, or loss of precision cannot occur.</blockquote><p><a name="frem.Notes"></a><p><b>Notes</b><br><blockquote><a name="68151"></a>The IEEE 754 remainder operation may be computed by the library routine <code>Math.IEEEremainder</code>.</blockquote><p><a name="freturn"></a><hr><h2>freturn</h2><a name="freturn.Operation"></a><p><b>Operation</b><br><blockquote><a name="68158"></a>Return <code>float</code> from method<p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68157"></a> <i>freturn</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="freturn.Forms"></a><p><b>Forms</b><br><blockquote><a name="68159"></a><i>freturn</i> = 174 (0xae)</blockquote><p><a name="freturn.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="87907"></a>..., <i>value</i><em> </em><img src="chars/arrwdbrt.gif">  [empty]</blockquote><p><a name="freturn.Description"></a><p><b>Description</b><br><blockquote><a name="68161"></a>The current method must have return type <code>float</code>. The <i>value</i> must be of type <code>float</code>. If the current method is a <code>synchronized</code> method, the monitor acquired or reentered on invocation of the method is released or exited (respectively) as if by execution of a <i>monitorexit</i> instruction. If no exception is thrown, <i>value</i> is popped from the operand stack of the current frame <a href="Overview.doc.html#17257">(&#167;3.6)</a> and undergoes value set conversion <a href="Overview.doc.html#33120">(&#167;3.8.3)</a>, resulting in <i>value'</i>. The <i>value'</i> is pushed onto the operand stack of the frame of the invoker. Any other values on the operand stack of the current method are discarded.</blockquote><p><blockquote><a name="68165"></a>The interpreter then returns control to the invoker of the method, reinstating the frame of the invoker.</blockquote><p><a name="freturn.Runtime"></a><p><b>Runtime Exceptions</b><br><blockquote><a name="250717"></a>If the current method is a <code>synchronized</code> method and the current thread is not the owner of the monitor acquired or reentered on invocation of the method, <i>freturn</i> throws an <code>IllegalMonitorStateException</code>. This can happen, for example, if a <code>synchronized</code> method contains a <i>monitorexit</i> instruction, but no <i>monitorenter</i> instruction, on the object on which the method is synchronized.</blockquote><p><blockquote><a name="250718"></a>Otherwise, if the virtual machine implementation enforces the rules on structured use of locks described in <a href="Threads.doc.html#22500">&#167;8.13</a> and if the first of those rules is violated during invocation of the current method, then <i>freturn</i> throws an <code>IllegalMonitorStateException</code>.</blockquote><p><a name="fstore"></a><hr><h2>fstore</h2><a name="fstore.Operation"></a><p><b>Operation</b><br><blockquote><a name="68177"></a>Store <code>float</code> into local variable<p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68174"></a> <i>fstore</i><td><a name="87568"></a> <tr><td><a name="68176"></a> <i>index</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="fstore.Forms"></a><p><b>Forms</b><br><blockquote><a name="68178"></a><i>fstore</i> = 56 (0x38)</blockquote><p><a name="fstore.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68179"></a>..., <i>value</i> <img src="chars/arrwdbrt.gif"> ...</blockquote><p><a name="fstore.Description"></a><p><b>Description</b><br><blockquote><a name="68180"></a>The <i>index</i> is an unsigned byte that must be an index into the local variable array of the current frame <a href="Overview.doc.html#17257">(&#167;3.6)</a>. The <i>value</i> on the top of the operand stack must be of type <code>float</code>. It is popped from the operand stack and undergoes value set conversion <a href="Overview.doc.html#33120">(&#167;3.8.3)</a>, resulting in <i>value'</i>. The value of the local variable at <i>index</i> is set to <i>value'</i>.</blockquote><p><a name="fstore.Notes"></a><p><b>Notes</b><br><blockquote><a name="68184"></a>The <i>fstore</i> opcode can be used in conjunction with the <i>wide</i> instruction to access a local variable using a two-byte unsigned index.</blockquote><p><a name="fstore_n"></a><hr><h2>fstore_&lt;n&gt;</h2><a name="fstore_n.Operation"></a><p><b>Operation</b><br><blockquote>Store <code>float</code> into local variable<a name="68194"></a><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68193"></a> <i>fstore_&lt;n&gt;</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="fstore_n.Forms"></a><p><b>Forms</b><br><blockquote><a name="68195"></a><i>fstore_0</i> = 67 (0x43) <i>fstore_1</i> = 68 (0x44) <i>fstore_2</i> = 69 (0x45) <i>fstore_3</i> = 70 (0x46)</blockquote><p><a name="fstore_n.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68196"></a>..., <i>value</i><em> </em><img src="chars/arrwdbrt.gif"> ...</blockquote><p><a name="fstore_n.Description"></a><p><b>Description</b><br><blockquote><a name="68197"></a>The <i>&lt;n&gt;</i> must be an index into the local variable array of the current frame <a href="Overview.doc.html#17257">(&#167;3.6)</a>. The <i>value</i> on the top of the operand stack must be of type <code>float</code>. It is popped from the operand stack and undergoes value set conversion <a href="Overview.doc.html#33120">(&#167;3.8.3)</a>, resulting in <i>value'</i>. The value of the local variable at <i>&lt;n&gt;</i> is set to <i>value'</i>.</blockquote><p><a name="fstore_n.Notes"></a><p><b>Notes</b><br><blockquote><a name="68201"></a>Each of the <i>fstore_&lt;n&gt;</i> is the same as <i>fstore</i> with an <i>index</i> of <i>&lt;n&gt;</i>, except that the operand <i>&lt;n&gt;</i> is implicit.</blockquote><p><a name="fsub"></a><hr><h2>fsub</h2><a name="fsub.Operation"></a><p><b>Operation</b><br><blockquote><a name="68208"></a>Subtract <code>float</code><p><Table Border="1"></blockquote><p><b>Format</b><br><blockquote><tr><td><a name="68207"></a> <i>fsub</i><td><a name="87568"></a> </Table><br></blockquote><p><a name="fsub.Forms"></a><p><b>Forms</b><br><blockquote><a name="68209"></a><i>fsub</i> = 102 (0x66)</blockquote><p><a name="fsub.Operand"></a><p><b>Operand Stack</b><br><blockquote><a name="68210"></a>..., <i>value1</i><em>, </em><i>value2</i> <img src="chars/arrwdbrt.gif"> ..., <i>result</i></blockquote><p><a name="fsub.Description"></a><p><b>Description</b><br><blockquote><a name="68211"></a>Both <i>value1</i> and <i>value2</i> must be of type <code>float</code>. The values are popped from the operand stack and undergo value set conversion <a href="Overview.doc.html#33120">(&#167;3.8.3)</a>, resulting in <i>value1'</i> and <i>value2'</i>. The <code>float</code> <i>result</i> is <i>value1'</i> - <i>value2'</i>. The <i>result</i> is pushed onto the operand stack.</blockquote><p><blockquote><a name="68212"></a>For <code>float</code> subtraction, it is always the case that <code>a</code>-<code>b</code> produces the same result as <code>a</code>+(-<code>b</code>). However, for the <i>fsub</i> instruction, subtraction from zero is not the same as negation, because if <code>x</code> is +<code>0.0</code>, then <code>0.0</code>-<code>x</code> equals +<code>0.0</code>, but -<code>x</code> equals -<code>0.0</code>. </blockquote><p><blockquote><a name="68213"></a>The Java virtual machine requires support of gradual underflow as defined by IEEE 754. Despite the fact that overflow, underflow, or loss of precision may occur, execution of an <i>fsub</i> instruction never throws a runtime exception.</blockquote><p><hr><!-- This inserts footnotes--><p><a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc3.html">Prev</a> | <a href="Instructions2.doc5.html">Next</a> | <a href="VMSpecIX.fm.html">Index</a><p><font size="-1"><i>The Java</i><sup><font size=-2>TM</font></sup><i> Virtual Machine Specification </i><br><!-- HTML generated by Suzette Pelouch on March 30, 1999 --><i><a href="Copyright.doc.html">Copyright &#169 1999 Sun Microsystems, Inc.</a>All rights reserved</i><br>Please send any comments or corrections to <a href="mailto:jvm@java.sun.com">jvm@java.sun.com</a></font></body></html>

⌨️ 快捷键说明

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