---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 19 Edition"
java_version: 19
chapter: "Chapter 6. The Java Virtual Machine Instruction Set"
section: "6.5.i2f"
heading: "i2f"
parent: "6.5. Instructions"
source: https://docs.oracle.com/javase/specs/jvms/se19/html/jvms-6.html#jvms-6.5.i2f
id: "6.5.i2f"
url: https://jvm.obfuscated.software/jvms/se19/6.5.i2f.html
raw: https://jvm.obfuscated.software/jvms/se19/6.5.i2f.md
---

# i2f

## Operation

Convert `int` to `float`

## Format

```
i2f
```

## Forms

*i2f* = 134 (0x86)

## Operand Stack

..., *value* →

..., *result*

## Description

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 `float` *result* using the round to nearest rounding policy ([§2.8](2.8.md)). The *result* is pushed onto the operand stack.

## Notes

The *i2f* instruction performs a widening primitive conversion (JLS §5.1.2), but may result in a loss of precision because values of type `float` have only 24 significand bits.
