Operation
Convert double to long
Format
d2l
Forms
d2l = 143 (0x8f)
Operand Stack
..., value →
..., result
Description
The value on the top of the operand stack must be of type double. It is popped from the operand stack and undergoes value set conversion (§2.8.3) resulting in value'. Then value' is converted to a long. The result is pushed onto the operand stack:
- If the value' is NaN, the result of the conversion is a
long0. - Otherwise, if the value' is not an infinity, it is rounded to an integer value V, rounding towards zero using IEEE 754 round towards zero mode. If this integer value V can be represented as a
long, then the result is thelongvalue V. - Otherwise, either the value' must be too small (a negative value of large magnitude or negative infinity), and the result is the smallest representable value of type
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 typelong.
Notes
The d2l instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of value' and may also lose precision.