Contents | Prev | Next | Index | The JavaTM Virtual Machine Specification |
float
to long
f2l |
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 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
float
fadd |
Stack ..., value1, value2 ..., result
Description
Both value1 and value2 must be of type float
. The values are popped from the operand stack. The float
result is value1 + value2. The result is pushed onto the operand stack.
The result of an fadd instruction is governed by the rules of IEEE arithmetic:
float
, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent as a float
, we say the operation underflows; the result is then a zero of appropriate sign.
float
from arrayfaload |
Stack ..., arrayref, index ..., value
Description
The arrayref must be of type reference
and must refer to an array whose components are of type float
. The index must be of type int
. Both arrayref and index are popped from the operand stack. The float
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
, faload throws a NullPointerException
.
Otherwise, if index is not within the bounds of the array referenced by arrayref, the faload instruction throws an ArrayIndexOutOfBoundsException
.
float
arrayfastore |
Stack ..., arrayref, index, value ...
Description
The arrayref must be of type reference
and must refer to an array whose components are of type float
. The index must be of type int
and the value must be of type float
. The arrayref, index, and value are popped from the operand stack. The float
value is stored as the component of the array indexed by index.
Runtime Exceptions
If arrayref is null
, fastore throws a NullPointerException
.
Otherwise, if index is not within the bounds of the array referenced by arrayref, the fastore instruction throws an ArrayIndexOutOfBoundsException
.
float
fcmp<op> |
Stack ..., value1, value2 ..., result
Description
Both value1 and value2 must be of type float
. 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 fcmpg instruction pushes the int
value 1 onto the operand stack and the fcmpl 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 fcmpg and fcmpl instructions differ only in their treatment of a comparison involving NaN. NaN is unordered, so any float
comparison fails if either or both of its operands are NaN. With both fcmpg and fcmpl available, any float
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."
float
fconst_<f>
Description
Push the float
constant <f> (0.0, 1.0, or 2.0) onto the operand stack.
float
fdiv |
Stack ..., value1, value2 ..., result
Description
Both value1 and value2 must be of type float
. The values are popped from the operand stack. The float
result is value1 / value2. The result is pushed onto the operand stack.
The result of an fdiv instruction is governed by the rules of IEEE arithmetic:
float
using IEEE 754 round-to-nearest mode. If the magnitude is too large to represent as a float
, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent as a float
, we say the operation underflows; the result is then a zero of appropriate sign.
float
from local variablefload | |
index |
Description
The index is an unsigned byte that must be a valid index into the local variables of the current frame (§3.6). The local variable at index must contain a float
. The value of the local variable at index is pushed onto the operand stack.
Notes The float opcode can be used in conjunction with the wide instruction to access a local variable using a two-byte unsigned index.
float
from local variablefload_<n> |
Description
The <n> must be a valid index into the local variables of the current frame (§3.6). The local variable at <n> must contain a float
. The value of the local variable at <n> is pushed onto the operand stack.
Notes Each of the fload_<n> instructions is the same as fload with an index of <n>, except that the operand <n> is implicit.
float
fmul |
Stack ..., value1, value2 ..., result
Description
Both value1 and value2 must be of type float
. The values are popped from the operand stack. The float
result is value1 * value2. The result is pushed onto the operand stack.
The result of an fmul instruction is governed by the rules of IEEE arithmetic:
float
, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent as a float
, we say the operation underflows; the result is then a zero of appropriate sign.
float
fneg |
Description
The value must be of type float
. It is popped from the operand stack. The float
result is the arithmetic negation of value, -value. The result is pushed onto the operand stack.
For float
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 float
.
float
frem |
Stack ..., value1, value2 ..., result
Description
Both value1 and value2 must be of type float
. The values are popped from the operand stack. The result is calculated and pushed onto the operand stack as a float
.
The result of an frem instruction is not the same that of the as 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 frem 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 an frem instruction is governed by these rules:
Notes
The IEEE 754 remainder operation may be computed by the Java library routine Math.IEEEremainder
.
float
from methodfreturn |
Description
The returning method must have return type float
. The value must be of type float
. 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.
float
into local variablefstore | |
index |
Description
The index is an unsigned byte that must be a valid index into the local variables of the current frame (§3.6). The value on the top of the operand stack must be of type float
. It is popped from the operand stack, and the value of the local variable at index is set to value.
Notes The fstore opcode can be used in conjunction with the wide instruction to access a local variable using a two-byte unsigned index.
fstore_<n> |
float
into local variable
Description
The <n> must be a valid index into the local variables of the current frame (§3.6). The value on the top of the operand stack must be of type float
. It is popped from the operand stack, and the value of the local variable at <n> is set to value.
Notes Each of the fstore_<n> is the same as fstore with an index of <n>, except that the operand <n> is implicit.
float
fsub |
Stack ..., value1, value2 ..., result
Description
Both value1 and value2 must be of type float
. The values are popped from the operand stack. The float
result is value1 - value2. The result is pushed onto the operand stack.
For float
subtraction, it is always the case that a-b
produces the same result as a+(-b)
. However, for the fsub 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 an fsub instruction never throws a runtime exception.
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