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

📄 concepts.doc.html

📁 A Java virtual machine instruction consists of an opcode specifying the operation to be performed, f
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<b><i>double</i></b><th><b><i>double-extended-exponent</i></b><tr><td><a name="34592"></a><i>N</i><td><a name="34594"></a>24<td><a name="34596"></a>24<td><a name="34598"></a>53<td><a name="34600"></a>53<tr><td><a name="34602"></a>K<td><a name="34604"></a>8<td><a name="34606"></a><img src="chars/gtequal.gif"> 11<td><a name="34608"></a>11<td><a name="34610"></a><img src="chars/gtequal.gif"> 15<tr><td><a name="34612"></a><i>E</i>max<td><a name="34614"></a>+127<td><a name="34616"></a><img src="chars/gtequal.gif"> +1023<td><a name="34618"></a>+1023<td><a name="34620"></a><img src="chars/gtequal.gif"> +16383<tr><td><a name="34622"></a><i>E</i>min<td><a name="34624"></a>-126<td><a name="34626"></a><img src="chars/lt_equal.gif"> -1022<td><a name="34628"></a>-1022<td><a name="34630"></a><img src="chars/lt_equal.gif"> -16382</Table><br><br><p><a name="37314"></a><p><a name="38861"></a>Where one or both extended-exponent value sets are supported by an implementation, then for each supported extended-exponent value set there is a specific implementation-dependent constant <i>K</i>, whose value is constrained by <a href="Concepts.doc.html#34798">Table 2.1</a>; this value <i>K</i> in turn dictates the values for <i>E</i>min and <i>E</i>max.<p><a name="34634"></a>Each of the four value sets includes not only the finite nonzero values that are ascribed to it above, but also the five values positive zero, negative zero, positive infinity, negative infinity, and NaN.<p><a name="34635"></a>Note that the constraints in <a href="Concepts.doc.html#34798">Table 2.1</a> are designed so that every element of the float value set is necessarily also an element of the float-extended-exponent value set, the double value set, and the double-extended-exponent value set. Likewise, each element of the double value set is necessarily also an element of the double-extended-exponent value set. Each extended-exponent value set has a larger range of exponent values than the corresponding standard value set, but does not have more precision.<p><a name="34636"></a>The elements of the float value set are exactly the values that can be represented using the single floating-point format defined in the IEEE 754 standard, except that there is only one NaN value (IEEE 754 specifies 2<sup>24</sup> - 2 distinct NaN values). The elements of the double value set are exactly the values that can be represented using the double floating-point format defined in the IEEE 754 standard, except that there is only one NaN value (IEEE 754 specifies 2<sup>53</sup> - 2 distinct NaN values). Note, however, that the elements of the float-extended-exponent and double-extended-exponent value sets defined here do <i>not</i> correspond to the values that can be represented using IEEE 754 single extended and double extended formats, respectively.<p><a name="34643"></a>The float, float-extended-exponent, double, and double-extended-exponent value sets are not types. It is always correct for an implementation of the Java programming language to use an element of the float value set to represent a value of type float; however, it may be permissible in certain regions of code for an implementation to use an element of the float-extended-exponent value set instead. Similarly, it is always correct for an implementation to use an element of the double value set to represent a value of type double; however, it may be permissible in certain regions of code for an implementation to use an element of the double-extended-exponent value set instead.<p><a name="34287"></a>Except for NaN, floating-point values are <i>ordered</i>; arranged from smallest to largest, they are negative infinity, negative finite nonzero values, positive and negative zero, positive finite nonzero values, and positive infinity.<p><a name="34288"></a>On comparison, positive zero and negative zero are equal; thus the result of the expression 0.0 &#32;== &#32;-0.0 is true and the result of 0.0 &#32;&gt; &#32;-0.0 is false. But other operations can distinguish positive and negative zero; for example, 1.0/0.0 has the value positive infinity, while the value of 1.0/-0.0 is negative infinity.<p><a name="34289"></a>NaN is <i>unordered</i>, so the numerical comparison operators &lt;, &lt;=, &gt;, and &gt;= return false if either or both operands are NaN. The equality operator == returns false if either operand is NaN, and the inequality operator != returns true if either operand is NaN. In particular, x &#32;!= &#32;x is true if and only if x is NaN, and (x&lt;y) == !(x&gt;=y) will be false if x or y is NaN.<p><a name="34290"></a>Any value of a floating-point type may be cast to or from any numeric type. There are no casts between floating-point types and the type boolean.<p><a name="33499"></a><h3>2.4.4    Operators on Floating-Point Values</h3><a name="17902"></a>The Java programming language provides a number of operators that act on floating-pointvalues, including numerical comparison, arithmetic operators, increment and decrement, and numeric cast <a href="Concepts.doc.html#18168">(&#167;2.6.9)</a>.<p><a name="19472"></a>If at least one of the operands to a binary operator is of floating-point type, then the operation is a floating-point operation, even if the other operand is integral. Operands of certain unary and binary operators are subject to numeric promotion <a href="Concepts.doc.html#16021">(&#167;2.6.10)</a>.<p><a name="23051"></a>The values returned by operators on floating-point numbers are those specified by IEEE 754. In particular, the Java programming language requires support of IEEE 754 <i>denormalized</i> floating-point numbers and <i>gradual underflow</i>, which make it easier to prove desirable properties of particular numerical algorithms.<p><a name="17932"></a>The Java programming language requires that floating-point arithmetic behave as if every floating-point operator rounded its floating-point result to the result precision. <i>Inexact</i> results must be rounded to the representable value nearest to the infinitely precise result; if the two nearest representable values are equally near, the one having zero as its least significant bit is chosen. This is the IEEE 754 standard's default rounding mode known as <i>round to nearest</i> mode.<p><a name="17933"></a>When converting a floating-point value to an integer, <i>round towards zero</i> mode is used <a href="Concepts.doc.html#26142">(&#167;2.6.3)</a>. Round towards zero mode acts as though the number were truncated, discarding the significand bits. Round towards zero mode chooses as its result the format's value closest to and no greater in magnitude than the infinitely precise result.<p><a name="17934"></a>The floating-point operators of the Java programming language produce no exceptions <a href="Concepts.doc.html#22727">(&#167;2.16)</a>. An operation that overflows produces a signed infinity; an operation that underflows produces a denormalized value or a signed zero; and an operation that has no mathematically definite result produces NaN. All numeric operations (except for numeric comparison) with NaN as an operand produce NaN as a result.<p><a name="23230"></a>Any value of any floating-point type may be cast <a href="Concepts.doc.html#18168">(&#167;2.6.9)</a> to or from any numeric type. There are no casts between floating-point types and the type <code>boolean</code>.<p><a name="17937"></a><h3>2.4.5    Operators on <code>boolean</code> Values </h3><a name="29372"></a>The boolean operators include relational operators and logical operators. Only <code>boolean</code> expressions can be used in control flow statements and as the first operand of the conditional operator <code>?:</code>. An integral value <code>x</code> can be converted to a value of type <code>boolean</code>, following the C language convention that any nonzero value is <code>true</code>, by the expression <code>x!=0</code>. An object reference <code>obj</code> can be converted to a value of type <code>boolean</code>, following the C language convention that any reference other than <code>null</code> is <code>true</code>, by the expression <code>obj!=null</code>.<p><a name="29373"></a>There are no casts between the type <code>boolean</code> and any other type.<p><a name="29375"></a><h3>2.4.6    Reference Types, Objects, and Reference Values</h3><a name="25380"></a>There are three kinds of reference types: the <i>class types</i> <a href="Concepts.doc.html#29321">(&#167;2.8)</a>, the <i>interface types</i> <a href="Concepts.doc.html#16432">(&#167;2.13)</a>, and the <i>array types</i> <a href="Concepts.doc.html#16446">(&#167;2.15)</a>. An <i>object</i> is a dynamically created class instance or an array. The reference values (often just <i>references</i>) are <i>pointers </i>to these objects and a special null reference, which refers to no object.<p><a name="25388"></a>A class instance is explicitly created by a <i>class instance creation expression</i>, or by invoking the <code>newInstance</code> method of class <code>Class</code>. An array is explicitly created by an <i>array creation expression</i>. An object is created in the heap and is garbage-collected after there are no more references to it. Objects cannot be reclaimed or freed by explicit language directives.<p><a name="25389"></a>There may be many references to the same object. Most objects have state, stored in the fields of objects that are instances of classes or in the variables that are the components of an array object. If two variables contain references to the same object, the state of the object can be modified using one variable's reference to the object, and then the altered state can be observed through the other variable's reference.<p><a name="25393"></a>Each object has an associated <i>lock</i> (<a href="Concepts.doc.html#33308">&#167;2.19</a>, <a href="Threads.doc.html#22500">&#167;8.13)</a> that is used by <code>synchronized</code> methods and by the <code>synchronized</code> statement to provide control over concurrent access to state by multiple threads (<a href="Concepts.doc.html#33308">&#167;2.19</a>, <a href="Threads.doc.html#22488">&#167;8.12)</a>.<p><a name="39351"></a>Reference types form a hierarchy. Each class type is a subclass of another class type, except for the class <code>Object</code> <a href="Concepts.doc.html#27433">(&#167;2.4.7)</a>, which is the superclass <a href="Concepts.doc.html#32983">(&#167;2.8.3)</a> of all other class and array types. All objects, including arrays, support the methods of class <code>Object</code>. String literals <a href="Concepts.doc.html#20359">(&#167;2.3)</a> are references to instances of class <code>String</code> <a href="Concepts.doc.html#25486">(&#167;2.4.8)</a>.<p><a name="27433"></a><h3>2.4.7    The Class <code>Object</code></h3><a name="25481"></a>The standard class <code>Object</code> is the superclass <a href="Concepts.doc.html#32983">(&#167;2.8.3)</a> of all other classes. A variable of type <code>Object</code> can hold a reference to any object, whether it is an instance of a class or an array. All class and array types inherit the methods of class <code>Object</code>.<p><a name="25486"></a><h3>2.4.8    The Class <code>String</code> </h3><a name="25487"></a>Instances of class <code>String</code> represent sequences of Unicode characters <a href="Concepts.doc.html#25310">(&#167;2.1)</a>. A <code>String</code> object has a constant, unchanging value. String literals <a href="Concepts.doc.html#20359">(&#167;2.3)</a> are references 

⌨️ 快捷键说明

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