CONSTANT_Float tag 4
A float constant.
- Tag
4- Since
- class file 45.0 (Java 1.0)
- Size
- 5 bytes
- Loadable
- yes, with
ldc,ldc_w - Referred to by
- ldc and ldc_w
- ConstantValue of float fields
Layout
| Type | Field | What it holds |
|---|---|---|
u1 | tag | 4 |
u4 | bytes | IEEE 754 single precision, big-endian |
What it is for
A float constant. 0.0f, 1.0f and 2.0f have fconst instructions; every other float literal is an ldc of one of these.
How common it is
JDK 25.0.5's java.base has 100 Float constants in 42 of its 7,391 classes: <0.01% of all 1,059,609 constants.
A real one, byte by byte
Constant #84 of Numbers.class, compiled by javac 25:
| Offset | Bytes | Field | Value |
|---|---|---|---|
| 705 | 5 bytes | #84 Float | 0.5 |
| 705 | 04 | tag | 4 (Float) |
| 706 | 3f 00 00 00 | bytes | 0.5 |
Specification: JVMS §4.4, CONSTANT_Float_info (Java SE 25).