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

# f2l

## Operation

Convert `float` to `long`

## Format

```
f2l
```

## Forms

*f2l* = 140 (0x8c)

## Operand Stack

..., *value* →

..., *result*

## Description

The *value* on the top of the operand stack must be of type `float`. It is popped from the operand stack and undergoes value set conversion ([§2.8.3](2.8.3.md)), resulting in *value*'. Then *value*' is converted to a `long` *result*. This *result* is pushed onto the operand stack:

- If the *value*' is NaN, the result of the conversion is a `long` 0.
- Otherwise, if the *value*' is not an infinity, it is rounded to an integer value V, rounding towards zero using IEEE 754 round towards zero mode. If this integer value V can be represented as a `long`, then the *result* is the `long` value V.
- Otherwise, either the *value*' must be too small (a negative value of large magnitude or negative infinity), and the *result* is the smallest representable value of type `long`, or the *value*' must be too large (a positive value of large magnitude or positive infinity), and the *result* is the largest representable value of type `long`.

## Notes

The *f2l* instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of *value*' and may also lose precision.
