Floating-point
IEEE 754 encoding with sign, characteristic (Excess-q) and mantissa (fixed-point). Constant relative error.
Configure your inputs and press Compute to see the step-by-step computation.
How it works
Rounding error
For floating-point encoding the absolute error grows with the exponent, but the relative error stays bounded by a constant — equal precision across all magnitudes.
- Maximum absolute error
- 2e / 2k (worst case bei e = q = 1: ≈ 0.03125)
- Maximum relative error
- 1 / 2k = 1 / 26 = 0.015625 (konstant)
Press "Compute" to see the actual error of your current input.
When to use
Frequently asked questions
What is the difference between fixed point and floating point?
In fixed point the binary point sits at a fixed position, the absolute error is the same everywhere and the range is small. Floating point stores a mantissa and an exponent, so the point moves with the magnitude. This makes the range very large, and the relative error stays the same across all magnitudes.
How is an IEEE 754 float built?
A float (binary32) has 32 bits: 1 sign bit, 8 exponent bits in excess-127 code and 23 mantissa bits without the leading 1, which is fixed by normalisation. A double (binary64) has 1 sign bit, 11 exponent bits in excess-1023 code and 52 mantissa bits.
Why is 0.1 + 0.2 not exactly 0.3?
0.1 and 0.2 have no finite representation in binary, just like 1/3 in decimal. Both are rounded to the nearest representable number, and their sum does not hit the rounded 0.3 exactly. In double, 0.1 + 0.2 therefore gives 0.30000000000000004. Floating point numbers are compared with a tolerance, not with ==.