FP32 - Single Precision

IEEE 754 single-precision floating point: the workhorse of general-purpose computing

Bit Layout

An FP32 number uses 32 bits divided into three fields:

Sign
S
1 bit
Exponent
E
E
E
E
E
E
E
E
8 bits
Mantissa
23 bits
23 bits

The sign bit determines positive (0) or negative (1). The exponent is stored with a bias of 127. The mantissa (also called significand or fraction) stores the fractional part of the number, with an implicit leading 1 for normal numbers.

Overview

FP32, also known as single precision or float, is defined by the IEEE 754 standard. It has been the default floating-point type in most programming languages and hardware for decades.

With 8 exponent bits, FP32 can represent numbers spanning roughly 80 orders of magnitude (from about 10-38 to 1038). The 23 mantissa bits provide approximately 7.2 decimal digits of precision, which is sufficient for most scientific computing, graphics, and general-purpose applications.

FP32 is used everywhere: CPU arithmetic, GPU shaders, physics simulations, audio processing, and as the default training precision for many neural networks. It is the float type in C/C++, Java, and C#, and numpy.float32 in Python.

Encoding Rules

Normal Numbers

For most values, the number is encoded as:

value = (-1)sign × 2(exponent - 127) × (1 + mantissa / 223)

The leading 1. before the mantissa is implicit: it doesn't need to be stored, giving you an extra bit of precision for free. The stored exponent is biased by adding 127, so an actual exponent of 0 is stored as 127. The bias of 127 is calculated as 2(e-1) - 1, where e is the number of exponent bits (8).

Subnormal Numbers (Denormals)

When the stored exponent is all zeros (biased exponent = 0), the number is subnormal:

value = (-1)sign × 2-126 × (0 + mantissa / 223)

Subnormals have no implicit leading 1, and use a fixed exponent of -126. They allow "gradual underflow," where numbers can get closer to zero than the smallest normal number, at the cost of losing precision.

Special Values

Tip for beginners Think of the exponent as a "zoom level" and the mantissa as the "detail" at that zoom level. A larger exponent lets you represent bigger (or smaller) numbers, while more mantissa bits give you finer granularity between consecutive values.

Interactive Value Visualizer

Click any bit to flip it, drag the slider, or enter a decimal or hex value. The graphs show how values are distributed across the encoding space.

Dynamic Range & Precision

PropertyValue
Max Positive (Normal)3.402823466e+38
Min Positive (Normal)1.175494351e-38
Max Subnormal1.175494211e-38
Min Positive (Subnormal)1.401298464e-45
Machine Epsilon (at 1.0)1.192092896e-7
Approx. Decimal Digits~6.9
Exponent Bias127
Exponent Range2^-126 to 2^127
Total Bit Patterns4,294,967,296
Supports InfinityYes
Supports NaNYes

Special Values & Bit Patterns

Key values and their exact binary representations:

ValueBit PatternDecimal
+00 00000000 000000000000000000000000
-01 00000000 00000000000000000000000-0
Min Subnormal0 00000000 000000000000000000000011.401298464e-45
Max Subnormal0 00000000 111111111111111111111111.175494211e-38
Min Normal0 00000001 000000000000000000000001.175494351e-38
Max Normal0 11111110 111111111111111111111113.402823466e+38
+Infinity0 11111111 00000000000000000000000+Infinity
-Infinity1 11111111 00000000000000000000000-Infinity
NaN0 11111111 10000000000000000000000NaN

Format Comparison

See how FP32 compares to related floating-point formats:

PropertyFP32FP64FP16BF16
Total Bits32641616
Sign Bits1111
Exponent Bits81158
Mantissa Bits2352107
Bias127102315127
Max Value3.402823466e+381.797693135e+308655043.389531389e+38
Min Normal1.175494351e-382.225073859e-3080.000061035156251.175494351e-38
Epsilon1.192092896e-72.220446049e-160.00097656250.0078125
~Decimal Digits~6.9~15.7~3.0~2.1
Has InfinityYesYesYesYes
Has NaNYesYesYesYes
Has SubnormalsYesYesYesYes

Where FP32 Is Used