IEEE 754 Floating Point Calculator
See how a decimal number is stored as a 32 or 64-bit float, and its error.
What the IEEE 754 Floating Point Calculator does
IEEE 754 stores a number as a sign bit, a biased exponent and a mantissa — scientific notation in binary. Because the mantissa has fixed length, most decimal fractions cannot be stored exactly, and the small error that results is the root of nearly every floating-point surprise.
Formula
Value = (−1)^sign × 1.mantissa × 2^(exponent − bias)float32: 1 + 8 + 23 bits, bias 127float64: 1 + 11 + 52 bits, bias 1023Machine epsilon = 2^−mantissa bits
Inputs explained
| Input | Unit | Required | Notes |
|---|---|---|---|
| Decimal value | text | Yes | — |
| Precision | one of 2 options | Yes | — |
How to use it
- Choose Precision.
- Enter Decimal value.
- Select Calculate.
Worked example
Storing 0.1 as a 64-bit double.
- Value
- 0.1
- Precision
- Double (64-bit)
Stored as 0.1000000000000000055511151231257827 — an error of about +5.55 × 10⁻¹⁸. The bit pattern is 0x3FB999999999999A, with the mantissa repeating 1001 forever.
Reading the result
- "Relative error" and "unit in the last place" measure different things — relative error is how far off this specific value's stored form is, while ULP is the gap to the next representable value nearby, which matters when judging how close two computed floats need to be before treating them as equal.
- "Significant decimal digits" is the practical budget for choosing a precision — a value needing more digits than that will silently lose precision regardless of later display formatting.
Assumptions and limitations
- The displayed error is specific to the one value entered — a different input can be exactly representable (zero error, like 0.5 or 0.125) or have a larger relative error than 0.1's, so this is not a general statement about floating point's overall error rate.
- Machine epsilon is a fixed value regardless of magnitude, while ULP scales with magnitude — treating epsilon as if it applies everywhere misjudges precision for very large or very small numbers.
Common mistakes
- Assuming float32's "~7 significant digits" is a hard error bound rather than a rule of thumb — actual precision varies slightly by magnitude within a format, and this calculator's own per-value error figure is the more exact answer for any specific number.
Frequently asked questions
Why does 0.1 + 0.2 not equal 0.3?
Neither 0.1 nor 0.2 is exactly representable in binary. Their stored values sum to something marginally above 0.3, and that sum is a different double from the one nearest 0.3.
When should I use float32 instead of float64?
When memory or bandwidth matters more than precision — graphics, machine learning weights, large sensor arrays. Seven significant digits is often plenty.
What is machine epsilon?
The gap between 1.0 and the next representable value: 2⁻⁵² for doubles, about 2.22 × 10⁻¹⁶. It sets the relative precision floor.