84.

prev next contents
i2f

convert integer to float

Jasmin Syntax
     i2f 
Stack

Before

After
int
float
...
...
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.

Bytecode

Type

Description
u1
i2f opcode = 0x86 (134)
See Also

i2l, i2d


prev next contents
Java Virtual Machine, by Jon Meyer and Troy Downing, O'Reilly Associates


Java Virtual Machine
Java Virtual Machine (Java Series)
ISBN: 1565921941
EAN: 2147483647
Year: 1996
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net