Free Floating Point Calculator

IEEE754 Converter in Action – From Binary to Decimal and Back

A floating‑point calculator streamlines the process of converting between IEEE754 binary representations and human‑readable decimal values. This tool handles both 32‑bit float and 64‑bit float formats, letting you work in either direction: transform a binary string into its decimal equivalent, or encode a real number as the bits that a computer stores. Whether you need a reliable binary to floating point converter or a float to decimal converter, the calculator delivers immediate results with full transparency into the internal IEEE754 logic.

How the Number‑to‑Floating‑Point Tool Works

Using the converter is straightforward. Choose your desired direction:

  • Floating‑point (binary) → number
    Select the precision (32‑bit or 64‑bit), then enter the binary digits. You can input the sign bit, exponent field, and fraction field separately, or paste the whole bit string at once. The calculator instantly interprets the bits according to the IEEE754 rules and shows the real decimal value.

  • Number → floating‑point (binary)
    Enter a decimal number and the tool returns both the binary and hexadecimal IEEE754 representations for single‑ and double‑precision. It also displays the exact stored value (which may differ from the original due to rounding) and the associated precision error, making it a complete 32‑bit float converter and 64‑bit float converter in one interface.

The IEEE754 Standard – Foundation of Modern Floating‑Point

IEEE754 (established in 1985 by the Institute of Electrical and Electronics Engineers) defines how digital systems store and operate on fractional numbers. A floating‑point number is built from three distinct bit segments:

  • Sign (S) – indicates positive or negative.
  • Exponent (E) – scales the number by a power of two.
  • Fraction (F) – holds the precise digits of the number.

These bits are concatenated in memory: S, then E, then F. The computer manipulates the raw bits directly, and the real decimal value is reconstructed using a formula that depends on the bit lengths and an exponent bias.

Supported Formats

FormatTotal BitsExponent BitsFraction BitsExponent BiasApprox. Range (positive normal)
single (float32)328231271.4×10−451.4 \times 10^{-45} to 3.4×10383.4 \times 10^{38}
double (float64)64115210235.0×10−3245.0 \times 10^{-324} to 1.7×103081.7 \times 10^{308}

Half‑precision (16‑bit), quadruple‑precision (128‑bit), and octuple‑precision (256‑bit) also exist, but the 32‑bit and 64‑bit versions are by far the most common.

Decoding a 32‑bit Float

For a normal (non‑special) float32, the reconstructed value is:

(−1)S×2E−127×(1.F)2(-1)^{S} \times 2^{E-127} \times (1.F)_{2}

where (1.F)2(1.F)_{2} means the binary digits of the fraction are appended to an implicit leading 1, forming a binary fraction.

If E=0E = 0 and the fraction is non‑zero, the number is subnormal:

(−1)S×2−126×(0.F)2(-1)^{S} \times 2^{-126} \times (0.F)_{2}

This formula lets the format represent very small numbers with gradual underflow.

Special Cases

Exponent (E)Fraction (F)Meaning
00±0\pm 0 (sign bit determines sign)
0>0Subnormal number (formula above)
0<E<2550 < E < 255AnyNormal number (formula above)
2550±∞\pm \infty
255>0NaN (Not a Number)

Example – Binary to Decimal for float32

Consider the 32‑bit string:
01000001110111100000000000000000

  1. Sign bit (b1): 0 → positive.
  2. Exponent bits (b2–b9): 10000011₂ = 131.
  3. Fraction bits (b10–b32): 10111100000000000000000₂.

Since 0<E<2550 < E < 255, use the normal formula:

(−1)0=12131−127=24=16(1.F)2=1.1011112=1.734375\begin{aligned} (-1)^{0} &= 1 \\ 2^{131-127} &= 2^{4} = 16 \\ (1.F)_{2} &= 1.101111_{2} = 1.734375 \end{aligned} Result=1×16×1.734375=27.75\text{Result} = 1 \times 16 \times 1.734375 = 27.75

Notice that the same bit string interpreted as a plain binary integer would give over a billion – the IEEE754 interpretation is completely different.

The 64‑bit Float Format

Double‑precision operates on the same principle, but with an 11‑bit exponent (bias 1023) and a 52‑bit fraction. The formulas become:

Normal:

(−1)S×2E−1023×(1.F)2(-1)^{S} \times 2^{E-1023} \times (1.F)_{2}

Subnormal:

(−1)S×2−1022×(0.F)2(-1)^{S} \times 2^{-1022} \times (0.F)_{2}

Thanks to the extra bits, float64 can store numbers with far greater range and precision than float32.

Converting a Decimal to IEEE754 Binary

To encode a number, convert it to binary, normalize it into the form 1.xxx×2n1.xxx \times 2^{n}, then extract the sign, exponent, and fraction.

Example: 27.75

  • Integer part: 2710=11011227_{10} = 11011_2
  • Fraction part: 0.7510=0.1120.75_{10} = 0.11_2
  • Full binary: 11011.11211011.11_2
  • Normalized: 1.1011112×241.101111_2 \times 2^{4}

Thus:

  • S = 0 (positive)
  • E = 4+127=131=1000001124 + 127 = 131 = 10000011_2
  • F = fraction bits 101111 padded with zeros to 23 bits → 10111100000000000000000

Result: 0 10000011 10111100000000000000000 – exactly the string we decoded earlier.

Floating‑Point Precision and the 0.1 Paradox

A critical fact: not every decimal number can be stored exactly in IEEE754. For example, the simple value 0.1 becomes a repeating binary fraction. When stored as a float32, it is approximated as:

00111101110011001100110011001101

Re‑decoding this gives a value slightly larger than 0.1, with an error of about 1.49×10−91.49 \times 10^{-9}. Even the best possible 32‑bit representation misses the target. Switching to float64 reduces the error (to 5.55×10−185.55 \times 10^{-18} for 0.1) but does not eliminate it.

This built‑in imprecision is a trade‑off for efficiency. Only numbers that are integer multiples of a power of two can be stored without loss – all other values are approximated. Being aware of these rounding errors is essential for scientific computing, numerical analysis, and any application that demands high accuracy.

FAQ

1. How do I convert a binary IEEE754 string to a decimal number?

Select the direction 'floating‑point to number', choose the precision (32‑bit or 64‑bit), then enter the binary string (either as separate sign/exponent/fraction or as a single bit string). The calculator instantly shows the real decimal value using the IEEE754 formulas, including special cases like infinity and NaN.

2. What is the difference between float32 and float64 in IEEE754?

Float32 uses 8 exponent bits (bias 127) and 23 fraction bits, while float64 uses 11 exponent bits (bias 1023) and 52 fraction bits. This gives float64 a much larger range and higher precision, but it also uses twice the memory. Both follow the same structural rules for sign, exponent, and fraction decoding.

3. Why can’t 0.1 be represented exactly as a floating‑point number?

In binary, 0.1 is a repeating fractional value (like 1/3 in decimal). IEEE754 relies on a finite number of bits, so it must round the representation. Even with float64, the stored value is slightly off (error ~5.55×10⁻¹⁸). Only numbers that are integer multiples of a power of two can be stored without any loss.

4. What are normal and subnormal floating‑point numbers?

A normal number uses an implicit leading 1 in the fraction and a biased exponent greater than 0. When the exponent is 0 and the fraction is non‑zero, the number is subnormal – it has a leading 0, which allows gradual underflow for very small values. Subnormals have fewer significant bits and thus lower precision.

How to Use

  1. Select your conversion mode - Choose between converting binary representation to a decimal number, or converting a decimal number to its IEEE754 binary representation.
  2. Enter your value - For binary-to-number, enter the sign, exponent, and fraction bits (or the full bit-string). For number-to-binary, type any real number.
  3. View the results - See the converted value, hexadecimal representation, and detailed breakdown of the IEEE754 components.