d2l
Stack
Before
|
After
|
| double-word1
|
long-word1
|
| double-word2
|
long-word2
|
| ...
|
...
|
Pops a two-word double precision floating point number off of the operand stack, converts it into a 64-bit long integer, and pushes the resulting two-word long onto the stack.
Rounding is done using IEEE 754 round-to-nearest mode. The fractional part is lost by rounding towards zero, so (long)-3.14 becomes -3.
If the original double value is NaN, the result is 0. If the value is too large to be represented as an integer, or if it is positive infinity, the result is the largest possible long integer Long.MAX_VALUE. If the value is too small (i.e. a negative value of large magnitude, or negative infinity) then the result is the most negative long integer Long.MIN_VALUE.
In some implementations, this may be coded using the C casting mechanism, e.g.
void d2l(double d, int &l_high, int &l_low)
{
l_low = (unsigned int)d;
l_high = (unsigned int)(d / 2**32);
}
where
l_low and l_high are respectively the least significant and most significant
32-bit words of the long.
Bytecode
Type
See Also
Description
u1
d2l
opcode = 0x8F (143)
d2i, d2f