Contents Prev Next Up

## The Virtual Machine Instruction Set

# Conversion Operations

i2l
i2f
i2d
l2i
l2f
l2d
f2i
f2l
f2d
d2i
d2l
d2f
int2byte
int2char
int2short

### i2l

Integer to long integer conversion

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

value should be an integer. It is converted to a long integer. The result replaces value on the stack.

### i2f

Integer to single float

    ..., value => ..., result

value should be an integer. It is converted to a single precision floating point number. The result replaces value on the stack.

### i2d

Integer to double float

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

value should be an integer. It is converted to a double precision floating point number. The result replaces value on the stack.

### l2i

Long integer to integer

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

value should be a long integer. It is converted to a integer. The result replaces value on the stack.

### l2f

Long integer to single float

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

value should be a long integer. It is converted to a single precision floating point number. The result replaces value on the stack.

### l2d

Long integer to double float

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

value should be a long integer. It is converted to a double precision floating point number. The result replaces value on the stack.

### f2i

Single float to integer

    ..., value => ..., result

value should be a single precision floating point number. It is converted to an integer. The result replaces value on the stack.

### f2l

Single float to long integer

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

value should be a single precision floating point number. It is converted to a long integer. The result replaces value on the stack.

### f2d

Single float to double float

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

value should be a single precision floating point number. It is converted to a double precision floating point number. The result replaces value on the stack.

### d2i

Double float to integer

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

value should be a double precision floating point number. It is converted to an integer. The result replaces value on the stack.

### d2l

Double float to long integer

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

value should be a double precision floating point number. It is converted to a long integer. The result replaces value on the stack.

### d2f

Double float to single float

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

value should be a double precision floating point number. It is converted to a single precision floating point number. The result replaces value on the stack.

### int2byte

Integer to signed byte

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

value should be an integer. It is truncated to a signed 8-bit result, then sign extended to an integer. The result replaces value on the stack.

### int2char

Integer to char

    ..., <int> => ..., <result>

value should be an integer. It is truncated to an unsigned 16-bit result, then sign extended to an integer. The result replaces value on the stack.

### int2short

Integer to char

    ..., <int> => ..., <result>

value should be an integer. It is truncated to a signed 16-bit result, then sign extended to an integer. The result replaces value on the stack.

Contents Prev Next Up

Generated with CERN WebMaker