Contents | Prev | Next | Index | The JavaTM Virtual Machine Specification |
double
to float
d2f |
Stack ..., value.word1, value.word2 ..., result
Description
The value on the top of the operand stack must be of type double
. It is popped from the operand stack and converted to a float
result using IEEE 754 round-to-nearest mode. The result is pushed onto the operand stack.
A finite value too small to be represented as a float
is converted to a zero of the same sign; a finite value too large to be represented as a float
is converted to an infinity of the same sign. A double
NaN is converted to a float
NaN.
Notes The d2f instruction performs a narrowing primitive conversion (§2.6.3). It may lose information about the overall magnitude of value and may also lose precision.
double
to int
d2i |
Stack ..., value.word1, value.word2 ..., result
Description
The value on the top of the operand stack must be of type double
. It is popped from the operand stack and converted to an int
. The result is pushed onto the operand stack:
int
0.
int
, then the result is the int
value V.
int
, or the value must be too large (a positive value of large magnitude or positive infinity), and the result is the largest representable value of type int
.
Notes
double
to long
d2l |
Stack ..., value.word1, value.word2 ..., result.word1, result.word2
Description
The value on the top of the operand stack must be of type double
. It is popped from the operand stack and converted to a long
. The result is pushed onto the operand stack:
long
0.
long
, then the result is the long
value V.
long
, or the value must be too large (a positive value of large magnitude or positive infinity), and the result is the largest representable value of type long
.
Notes
double
dadd |
Stack ..., value1.word1, value1.word2, value2.word1, value2.word2 ..., result.word1, result.word2
Description
Both value1 and value2 must be of type double
. The values are popped from the operand stack. The double
result is value1 + value2. The result is pushed onto the operand stack.
The result of a dadd instruction is governed by the rules of IEEE arithmetic:
double
, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent as a double
, we say the operation underflows; the result is then a zero of appropriate sign.
double
from arraydaload |
Stack ..., arrayref, index ..., value.word1, value.word2
Description
The arrayref must be of type reference
and must refer to an array whose components are of type double
. The index must be of type int
. Both arrayref and index are popped from the operand stack. The double
value in the component of the array at index is retrieved and pushed onto the top of the operand stack.
Runtime Exceptions
If arrayref is null
, daload throws a NullPointerException
.
Otherwise, if index is not within the bounds of the array referenced by arrayref, the daload instruction throws an ArrayIndexOutOfBoundsException
.
double
arraydastore |
Stack ..., arrayref, index, value.word1, value.word2 ...
Description
The arrayref must be of type reference
and must refer to an array whose components are of type double
. The index must be of type int
and value must be of type double
. The arrayref, index, and value are popped from the operand stack. The double
value is stored as the component of the array indexed by index.
Runtime Exceptions
If arrayref is null
, dastore throws a NullPointerException
.
Otherwise, if index is not within the bounds of the array referenced by arrayref, dastore throws an ArrayIndexOutOfBounds
-Exception
.
double
dcmp<op> |
Stack ..., value1.word1, value1.word2, value2.word1, value2.word1 ..., result
Description
Both value1 and value2 must be of type double
. The values are popped from the operand stack, and a floating-point comparison is performed. If value1 is greater than value2, the int
value 1 is pushed onto the operand stack. If value1 is equal to value2, the int
value 0 is pushed onto the operand stack. If value1 is less than value2, the int
value -1 is pushed onto the operand stack. If either value1 or value2 is NaN, the dcmpg instruction pushes the int
value 1 onto the operand stack and the dcmpl instruction pushes the int
value -1 onto the operand stack.
Floating-point comparison is performed in accordance with IEEE 754. All values other than NaN are ordered, with negative infinity less than all finite values and positive infinity greater than all finite values. Positive zero and negative zero are considered equal.
Notes
The dcmpg and dcmpl instructions differ only in their treatment of a comparison involving NaN. NaN is unordered, so any double
comparison fails if either or both of its operands are NaN. With both dcmpg and dcmpl available, any double
comparison may be compiled to push the same result onto the operand stack whether the comparison fails on non-NaN values or fails because it encountered a NaN. For more information, see Section 7.5, "More Control Examples."
double
dconst_<d> |
Stack ... ..., <d>.word1, <d>.word2
Description
Push the double
constant <d> (0.0 or 1.0) onto the operand stack.
double
ddiv |
Stack ..., value1.word1, value1.word2, value2.word1, value2.word2 ..., result.word1, result.word2
Description
Both value1 and value2 must be of type double
. The values are popped from the operand stack. The double
result is value1 / value2. The result is pushed onto the operand stack.
The result of a ddiv instruction is governed by the rules of IEEE arithmetic:
double
using IEEE 754 round-to-nearest mode. If the magnitude is too large to represent as a double
, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent as a double
, we say the operation underflows; the result is then a zero of appropriate sign.
double
from local variabledload | |
index |
Stack ... ..., value.word1, value.word2
Description
The index is an unsigned byte. Both index and index + 1 must be valid indices into the local variables of the current frame (§3.6). The local variables at index and index + 1 together must contain a double
. The value of the local variables at index and index + 1 is pushed onto the operand stack.
Notes The dload opcode can be used in conjunction with the wide instruction to access a local variable using a two-byte unsigned index.
double
from local variabledload_<n> |
Stack ... ..., value.word1, value.word2
Description
Both <n> and <n> + 1 must be valid indices into the local variables of the current frame (§3.6). The local variables at <n> and <n> + 1 together must contain a double
. The value of the local variables at <n> and <n> + 1 is pushed onto the operand stack.
Notes Each of the dload_<n> instructions is the same as dload with an index of <n>, except that the operand <n> is implicit.
double
dmul |
Stack ..., value1.word1, value1.word2, value2.word1, value2.word2 ..., result.word1, result.word2
Description
Both value1 and value2 must be of type double
. The values are popped from the operand stack. The double
result is value1 * value2. The result is pushed onto the operand stack.
The result of a dmul instruction is governed by the rules of IEEE arithmetic:
double
, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent as a double
, we say the operation underflows; the result is then a zero of appropriate sign.
double
dneg |
Stack ..., value.word1, value.word2 ..., result.word1, result.word2
Description
The value must be of type double
. It is popped from the operand stack. The double
result is the arithmetic negation of value, namely -value. The result is pushed onto the operand stack.
For double
values, negation is not the same as subtraction from zero. If x
is +0.0
, then 0.0-x
equals +0.0
, but -x
equals -0.0.
Unary minus merely inverts the sign of a double
.
double
drem |
Stack ..., value1.word1, value1.word2, value2.word1, value2.word2 ..., result.word1, result.word2
Description
Both value1 and value2 must be of type double
. The values are popped from the operand stack. The result is calculated and pushed onto the operand stack as a double
.
The result of a drem 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 not analogous to that of the usual integer remainder operator. Instead, the Java Virtual Machine defines drem to behave in a manner analogous to that of the Java Virtual Machine integer remainder instructions (irem and lrem); this may be compared with the C library function fmod
.
The result of a drem instruction is governed by these rules:
Notes
The IEEE 754 remainder operation may be computed by the Java library routine Math.IEEEremainder
.
double
from methoddreturn |
Stack ..., value.word1, value.word2
Description
The returning method must have return type double
. The value must be of type double
. The value is popped from the operand stack of the current frame (§3.6) and pushed onto the operand stack of the frame of the invoker. Any other values on the operand stack of the current method are discarded. If the returning method is a synchronized
method, the monitor acquired or reentered on invocation of the method is released or exited (respectively) as if by execution of a monitorexit instruction.
The interpreter then returns control to the invoker of the method, reinstating the frame of the invoker.
double
into local variabledstore | |
index |
Stack ..., value.word1, value.word2 ...
Description
The index is an unsigned byte. Both index and index + 1 must be valid indices into the of the current frame (§3.6). The value on the top of the operand stack must be of type double
. It is popped from the operand stack, and the local variables at index and index + 1 are set to value.
Notes The dstore opcode can be used in conjunction with the wide instruction to access a local variable using a two-byte unsigned index.
dstore_<n> |
double
into local variableStack ..., value.word1, value.word2 ...
Description
Both <n> and <n> + 1 must be valid indices into the local variables of the current frame (§3.6). The value on the top of the operand stack must be of type double
. It is popped from the operand stack, and the local variables at <n> and <n> + 1 are set to value.
Notes Each of the dstore_<n> instructions is the same as dstore with an index of <n>, except that the operand <n> is implicit.
double
dsub |
Stack ..., value1.word1, value1.word2, value2.word1, value2.word2 ..., result.word1, result.word2
Description
Both value1 and value2 must be of type double
. The values are popped from the operand stack. The double
result is value1 - value2. The result is pushed onto the operand stack.
For double
subtraction, it is always the case that a-b
produces the same result as a+(-b)
. However, for the dsub instruction, subtraction from zero is not the same as negation, because if x
is +0.0
, then 0.0-x
equals +0.0
, but -x
equals -0.0
.
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 a dsub instruction never throws a runtime exception.
dup |
Stack ..., word ..., word, word
Description The top word on the operand stack is duplicated and pushed onto the operand stack.
The dup instruction must not be used unless word contains a 32-bit data type.
Notes Except for restrictions preserving the integrity of 64-bit data types, the dup instruction operates on an untyped word, ignoring the type of the datum it contains.
dup_x1 |
Stack ..., word2, word1 ..., word1, word2, word1
Description The top word on the operand stack is duplicated and the copy inserted two words down in the operand stack.
The dup_x1 instruction must not be used unless each of word1 and word2 is a word that contains a 32-bit data type.
Notes Except for restrictions preserving the integrity of 64-bit data types, the dup_x1 instruction operates on untyped words, ignoring the types of the data they contain.
dup_x2 |
Stack ..., word3, word2, word1 ..., word1, word3, word2, word1
Description The top word on the operand stack is duplicated and the copy inserted three words down in the operand stack.
The dup_x2 instruction must not be used unless each of word2 and word3 is a word that contains a 32-bit data type or together are the two words of a single 64-bit datum, and unless word1 contains a 32-bit data type.
Notes Except for restrictions preserving the integrity of 64-bit data types, the dup_x2 instruction operates on untyped words, ignoring the types of the data they contain.
dup2 |
Stack ..., word2, word1 ..., word2, word1, word2, word1
Description The top two words on the operand stack are duplicated and pushed onto the operand stack, in the original order.
The dup2 instruction must not be used unless each of word1 and word2 is a word that contains a 32-bit data type or both together are the two words of a single 64-bit datum.
Notes Except for restrictions preserving the integrity of 64-bit data types, the dup2 instruction operates on untyped words, ignoring the types of the data they contain.
dup2_x1 |
Stack ..., word3, word2, word1 ..., word2, word1, word3, word2, word1
Description The top two words on the operand stack are duplicated and the copies inserted, in the original order, three words down in the operand stack.
The dup2_x1 instruction must not be used unless each of word1 and word2 is a word that contains a 32-bit data type or both together are the two words that contain a single 64-bit datum, and unless word3 is a word that contains a 32-bit data type.
Notes Except for restrictions preserving the integrity of 64-bit data types, the dup2_x1 instruction operates on untyped words, ignoring the types of the data they contain.
dup2_x2 |
Stack ..., word4, word3, word2, word1 ..., word2, word1, word4, word3, word2, word1
Description The top two words on the operand stack are duplicated and the copies inserted, in the original order, four words down in the operand stack.
The dup2_x2 instruction must not be used unless each of word1 and word2 is a 32-bit data type or both together are the two words of a single 64-bit datum, and unless word3 and word4 are each a word that contains a 32-bit data type or both together are the two words of a single 64-bit datum.
Notes Except for restrictions preserving the integrity of 64-bit data types, the dup2_x2 instruction operates on untyped words, ignoring the types of the data they contain.
float
to double
f2d |
Stack ..., value ..., result.word1, result.word2
Description
The value on the top of the operand stack must be of type float
. It is popped from the operand stack and converted to a double
. The result is pushed onto the operand stack.
Notes
The f2d instruction performs a widening primitive conversion (§2.6.2). Because all values of type float
are exactly representable by type double
, the conversion is exact.
float
to int
f2i |
Description
The value on the top of the operand stack must be of type float
. It is popped from the operand stack and converted to an int
. The result is pushed onto the operand stack:
int
0.
int
, then the result is the int
value V.
int
, or the value must be too large (a positive value of large magnitude or positive infinity), and the result is the largest representable value of type int
.
Notes
Contents | Prev | Next | Index
Java Virtual Machine Specification
Copyright © 1996, 1997 Sun Microsystems, Inc.
All rights reserved
Please send any comments or corrections to jvm@java.sun.com