# Floating-Point Converter (IEEE 754)

URL: https://speedycalculator.com/calculators/other/floating-point/
Last updated: 2026-10-30

> The floating-point converter turns a decimal number into its IEEE 754 single (32-bit) and double (64-bit) precision bits and hexadecimal, shows the exact value stored and the rounding error, and decodes a bit pattern or hex value back into a number.

## Inputs

- I want to convert
- Decimal number — Examples: 27.75, -0.1, 6.02e23, inf, nan
- Precision
- Input method
- Bit string (32 or 64 bits)
- Sign bit (S)
- Exponent bits (E) – 8 or 11 bits
- Fraction bits (F) — Missing trailing bits are filled with zeros.
- Hexadecimal (8 or 16 digits)

## Results

- Value
- Type of number
- Fields
- Formula
- Note
- Single precision bits (S E F)
- Single precision hex
- Exact value stored in single precision
- Single precision conversion error
- Double precision bits (S E F)
- Double precision hex
- Exact value stored in double precision
- Double precision conversion error
- Breakdown

## Formula

```
Normal: value = (−1)^S × 2^(E − bias) × 1.F · Subnormal (E = 0): (−1)^S × 2^(1 − bias) × 0.F · bias = 127 (single), 1023 (double) · E all ones: ±∞ (F = 0) or NaN
```

## Explanation

Computers store real numbers in binary scientific notation defined by the IEEE 754 standard. A number is split into three fields: a sign bit, an exponent stored with a bias, and a fraction (mantissa) holding the digits after the leading 1. Single precision (float32) uses 1 + 8 + 23 bits and keeps about 7 significant decimal digits; double precision (float64) uses 1 + 11 + 52 bits and keeps about 15–16 digits.

Because only a fixed number of binary digits fit, most decimal fractions cannot be stored exactly. 0.1 in binary is 0.000110011001100… repeating forever, so the computer stores the nearest representable value: 0.100000001490116… as a float and 0.1000000000000000055511… as a double. That tiny error is why 0.1 + 0.2 does not equal 0.3 in most programming languages, and why money should be counted in whole cents.

The standard also reserves special patterns. An exponent of all zeros gives zero (with a sign!) and subnormal numbers that fill the gap down to zero; an exponent of all ones gives infinity or NaN ("not a number"). This converter shows every field, the exact decimal value actually stored and the conversion error, and works both ways – from a number to bits and from bits or hex back to a number.

### How to use the Floating-Point Converter

- **I want to convert**
- **Decimal number** — Examples: 27.75, -0.1, 6.02e23, inf, nan
- **Precision**
- **Input method**
- **Bit string (32 or 64 bits)**
- **Sign bit (S)**
- **Exponent bits (E) – 8 or 11 bits**
- **Fraction bits (F)** — Missing trailing bits are filled with zeros.
- **Hexadecimal (8 or 16 digits)**

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

### How it works

To encode, the number is rounded to the nearest representable value in each format and its bits are read out; the exact stored value is expanded digit by digit and compared with your input. To decode, the sign, exponent and fraction fields are separated and evaluated with the formula for normal, subnormal or special values.

### Worked example

27.75 in binary is 11011.11 = 1.101111 × 2⁴. The sign bit is 0, the exponent is 4 + 127 = 131 = 10000011₂ and the fraction is 10111100…0. The single precision pattern is 0 10000011 10111100000000000000000 = **0x41DE0000**, and it stores 27.75 exactly. Decoding works backwards: (−1)⁰ × 2^(131 − 127) × 1.734375 = 27.75. By contrast 0.1 becomes 0x3DCCCCCD, which stores 0.100000001490116119384765625 – an error of about 1.49 × 10⁻⁹.

### Format summary

PropertySingle (float32)Double (float64)Sign / exponent / fraction bits1 / 8 / 231 / 11 / 52Exponent bias1271023Decimal digits≈ 7≈ 15–16Largest value3.40 × 10³⁸1.80 × 10³⁰⁸Smallest normal1.18 × 10⁻³⁸2.23 × 10⁻³⁰⁸Machine epsilon1.19 × 10⁻⁷2.22 × 10⁻¹⁶

## Worked example

Inputs — I want to convert: Number → floating point (bits and hex); Decimal number: 0.1.

Results — **Value = 0.1 (single) · 0.1 (double)**; Single precision bits (S E F) = 0 01111011 10011001100110011001101; Single precision hex = 0x3DCCCCCD; Exact value stored in single precision = 0.100000001490116119384765625; Single precision conversion error = 1.490116 × 10^-9 (relative 1.490 × 10^-8); Double precision bits (S E F) = 0 01111111011 1001100110011001100110011001100110011001100110011010.

## Key terms

- **Sign bit (S)**: 0 for positive, 1 for negative numbers.
- **Exponent (E)**: Power of two, stored with a bias added.
- **Fraction / mantissa (F)**: Bits after the binary point of the significand 1.F.
- **Machine epsilon**: Gap between 1 and the next float: 2⁻²³ ≈ 1.19 × 10⁻⁷ (single), 2⁻⁵² ≈ 2.22 × 10⁻¹⁶ (double).

## FAQ

**Why is 0.1 + 0.2 not equal to 0.3?**
Neither 0.1 nor 0.2 is exact in binary; their stored values add up to 0.30000000000000004 in double precision.

**How many digits does a float hold?**
Single precision about 7 significant decimal digits, double precision about 15–16.

**What is the bias?**
A constant added to the exponent so it can be stored as an unsigned number: 127 for single, 1023 for double.

**What is the largest float?**
About 3.4028235 × 10³⁸ in single precision and 1.7976931 × 10³⁰⁸ in double precision.

**What are subnormal numbers?**
Values with an all-zero exponent that fill the gap near zero without the hidden leading 1, down to 1.4 × 10⁻⁴⁵ (single).

**Why is there a −0?**
The sign bit is separate, so zero can be positive or negative; they compare equal but behave differently in 1 ÷ x.

**What does NaN mean?**
"Not a number" – the result of undefined operations like 0 ÷ 0 or √−1; any exponent of all ones with a non-zero fraction.


## Sources

- [IEEE 754-2019 – Standard for Floating-Point Arithmetic](https://standards.ieee.org/ieee/754/6210/)
- [Goldberg, D. – What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html)
