i2f :
convert integer to float : index : visitInsn()
- Description
- Pops an int off the operand stack, casts it into a single-precision
float, and pushes the float back onto the stack. Notice that
there is may be a loss of precision (floats have 24 bits of significand, as
compared to 32 bits for an int, so the least significant bits of int are
lost). However, the magnitude of the result will be preserved (the range of a
float is greater than the range of an int). Rounding is done using the IEEE 754
round-to-nearest mode.
- See also
- i2l i2d
- Stack
Before
|
After |
int |
float |
... |
... |
- Bytecode
Type
|
Description |
u1
|
i2f
opcode = 0x86 (134)
|