Basics
A floating point number stores three parts: a sign bit, exponent bits, and fraction (mantissa) bits. For normal numbers, the value is interpreted as:
value = (-1)^sign * (1 + fraction) * 2^(exponent - bias)
- Sign bit: 0 means positive, 1 means negative.
- Exponent controls magnitude with a bias (127 for 32-bit, 1023 for 64-bit).
- Fraction stores precision to the right of the binary point.
- Special exponent patterns produce subnormal values, infinities, and NaN.
Because many decimal fractions have repeating binary expansions, values like 0.1 cannot be represented exactly.
Floating Point Number Ranges
Different formats trade range and precision by changing exponent and fraction bit counts.
| Format | Bits | Exponent / Fraction | Approx Max Finite | Min Normal | Min Subnormal | Machine Epsilon |
|---|---|---|---|---|---|---|
| binary16 (half) | 16 | 5 / 10 | 6.5504e4 | 6.1035e-5 | 5.9605e-8 | 9.7656e-4 |
| binary32 (float) | 32 | 8 / 23 | 3.4028235e38 | 1.17549435e-38 | 1.40129846e-45 | 1.1920929e-7 |
| binary64 (double) | 64 | 11 / 52 | 1.7976931348623157e308 | 2.2250738585072014e-308 | 4.9406564584124654e-324 | 2.220446049250313e-16 |
Interactive Calculator: Adjust Bits -> Value
Toggle bits directly to see how sign, exponent, and fraction change the resulting binary32 value.
Format: binary32 (float)
Sign Exponent Fraction
Decoded Value
Class: -
-
Fields
-
Interactive Calculator: Adjust Number -> Bits
Type a decimal number and see its nearest representable bit pattern in binary32.
Format: binary32 (float)
Encoded Pattern
-
Details
-