---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 20 Edition"
java_version: 20
chapter: "Chapter 4. The class File Format"
section: "4.4.5"
heading: "4.4.5. The CONSTANT_Long_info and CONSTANT_Double_info Structures"
parent: "4.4. The Constant Pool"
source: https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-4.html#jvms-4.4.5
id: "4.4.5"
url: https://jvm.obfuscated.software/jvms/se20/4.4.5.html
raw: https://jvm.obfuscated.software/jvms/se20/4.4.5.md
---

# 4.4.5. The `CONSTANT_Long_info` and `CONSTANT_Double_info` Structures

The `CONSTANT_Long_info` and `CONSTANT_Double_info` represent 8-byte numeric (`long` and `double`) constants:

```
CONSTANT_Long_info {
    u1 tag;
    u4 high_bytes;
    u4 low_bytes;
}

CONSTANT_Double_info {
    u1 tag;
    u4 high_bytes;
    u4 low_bytes;
}
```

All 8-byte constants take up two entries in the `constant_pool` table of the `class` file. If a `CONSTANT_Long_info` or `CONSTANT_Double_info` structure is the entry at index *n* in the `constant_pool` table, then the next usable entry in the table is located at index *n*+2. The `constant_pool` index *n*+1 must be valid but is considered unusable.

In retrospect, making 8-byte constants take two constant pool entries was a poor choice.

The items of these structures are as follows:

- **tag**

  The `tag` item of the `CONSTANT_Long_info` structure has the value `CONSTANT_Long` (5).

  The `tag` item of the `CONSTANT_Double_info` structure has the value `CONSTANT_Double` (6).

- **high_bytes, low_bytes**

  The unsigned `high_bytes` and `low_bytes` items of the `CONSTANT_Long_info` structure together represent the value of the `long` constant

  ```
  ((long) high_bytes << 32) + low_bytes
  ```

  where the bytes of each of `high_bytes` and `low_bytes` are stored in big-endian (high byte first) order.

  The `high_bytes` and `low_bytes` items of the `CONSTANT_Double_info` structure together represent the `double` value in IEEE 754 binary64 floating-point format ([§2.3.2](2.3.2.md)). The bytes of each item are stored in big-endian (high byte first) order.

  The value represented by the `CONSTANT_Double_info` structure is determined as follows. The `high_bytes` and `low_bytes` items are converted into the `long` constant *bits*, which is equal to

  ```
  ((long) high_bytes << 32) + low_bytes
  ```

  Then:

  - If *bits* is `0x7ff0000000000000L`, the `double` value will be positive infinity.

  - If *bits* is `0xfff0000000000000L`, the `double` value will be negative infinity.

  - If *bits* is in the range `0x7ff0000000000001L` through `0x7fffffffffffffffL` or in the range `0xfff0000000000001L` through `0xffffffffffffffffL`, the double value will be NaN.

  - In all other cases, let `s`, `e`, and `m` be three values that might be computed from *bits*:

    ```
    int s = ((bits >> 63) == 0) ? 1 : -1;
    int e = (int)((bits >> 52) & 0x7ffL);
    long m = (e == 0) ?
               (bits & 0xfffffffffffffL) << 1 :
               (bits & 0xfffffffffffffL) | 0x10000000000000L;
    ```

  Then the floating-point value equals the `double` value of the mathematical expression `s · m · 2^{e-1075}`.
