i2d

Convert int to double

Bytecode

Type Description
u1 i2d opcode = 0x87 (135)

Stack ..., value => ..., result.word1, result.word2

Description

Pops an int off the operand stack, casts it into a double precision floating point number, and pushes the two-word double precision result back onto the stack. This conversion is exact, since doubles have enough precision to represent all int values.

The value on the top of the operand stack must be of type int. It is popped from the operand stack and converted to a double result. The result is pushed onto the operand stack.

Notes

The i2d instruction performs a widening primitive conversion . Because all values of type int are exactly representable by type double, the conversion is exact.