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

TypeFieldWhat it holds
u1tag4
u4bytesIEEE 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:

OffsetBytesFieldValue
7055 bytes#84 Float0.5
70504tag4 (Float)
7063f 00 00 00bytes0.5

Open in the viewer

Specification: JVMS §4.4, CONSTANT_Float_info (Java SE 25).