---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 13 Edition"
java_version: 13
chapter: "Chapter 4. The class File Format"
section: "4.10.2.3"
heading: "4.10.2.3. Values of Types long and double"
parent: "4.10.2. Verification by Type Inference"
source: https://docs.oracle.com/javase/specs/jvms/se13/html/jvms-4.html#jvms-4.10.2.3
id: "4.10.2.3"
url: https://jvm.obfuscated.software/jvms/se13/4.10.2.3.html
raw: https://jvm.obfuscated.software/jvms/se13/4.10.2.3.md
---

# 4.10.2.3. Values of Types `long` and `double`

Values of the `long` and `double` types are treated specially by the verification process.

Whenever a value of type `long` or `double` is moved into a local variable at index *n*, index *n*+1 is specially marked to indicate that it has been reserved by the value at index *n* and must not be used as a local variable index. Any value previously at index *n*+1 becomes unusable.

Whenever a value is moved to a local variable at index *n*, the index *n*-1 is examined to see if it is the index of a value of type `long` or `double`. If so, the local variable at index *n*-1 is changed to indicate that it now contains an unusable value. Since the local variable at index *n* has been overwritten, the local variable at index *n*-1 cannot represent a value of type `long` or `double`.

Dealing with values of types `long` or `double` on the operand stack is simpler; the verifier treats them as single values on the stack. For example, the verification code for the *dadd* opcode (add two `double` values) checks that the top two items on the stack are both of type `double`. When calculating operand stack length, values of type `long` and `double` have length two.

Untyped instructions that manipulate the operand stack must treat values of type `long` and `double` as atomic (indivisible). For example, the verifier reports a failure if the top value on the stack is a `double` and it encounters an instruction such as *pop* or *dup*. The instructions *pop2* or *dup2* must be used instead.
