IEEE 754 converter

This IEEE 754 converter turns a decimal number into the 16, 32 or 64-bit pattern and shows sign, exponent, mantissa, the exact stored value and the rounding error. You can also enter hex or bits.

Source: Wikipedia – IEEE 754 (Formate, Bias, subnormale Zahlen, Sonderwerte). Updated: .

My ToolboxYour inputs are saved in this browser only.

Result

Result
0x3DCCCCCD · 0 01111011 10011001100110011001101
Bit layout
PartBitsMeaning
Sign0+
Exponent (8 bit)01111011123 − 127 = -4
Mantissa (23 bit)100110011001100110011011.10011001100110011001101
Stored value
MeasureValue
Hex0x3DCCCCCD
Typenormal number
Exact stored value0.100000001490116119384765625
Difference from the input+1.490e-9
Predecessor0.0999999940395355224609375
Successor0.10000000894069671630859375
Values are rounded to the nearest representable number, ties to the even mantissa. Predecessor and successor show the spacing between neighbouring floating-point numbers. For 32 bits: value = (−1)^s · 2^(e − bias) · (1 + m/2^p).

How it is calculated

A floating-point number consists of a sign s, an exponent e and a mantissa m: value = (−1)^s · 2^(e − bias) · 1.m. The decimal 0.1 becomes 0x3DCCCCCD as a float and is stored as 0.100000001490116119384765625.

The three formats

Why 0.1 is not exact

Floating-point numbers store powers of two, but 0.1 is a repeating fraction in binary. It is therefore rounded, and 0.1 + 0.2 gives 0.30000000000000004. The converter shows the exact stored decimal value and the rounding error.

Special values

If all exponent bits are 1, the number is infinity (mantissa 0) or NaN (mantissa not 0). If all exponent bits are 0, the number is zero or subnormal, stored without the leading one.

Frequently asked questions

How do you convert a decimal number to IEEE 754?

Split it into a sign, a base-2 exponent and a mantissa and store them in 8 + 23 bits (float) or 11 + 52 bits (double). The converter does this and shows hex and bits.

Why is 0.1 as a float not exactly 0.1?

0.1 is an infinite fraction in binary and has to be rounded. As a float that gives 0.100000001490116…, as a double 0.1000000000000000055….

What do the bits of a float mean?

The first bit is the sign, the next 8 bits the exponent with bias 127 and the last 23 bits the mantissa without the leading one.

Sources and legal basis

As of: · Editorial policy

Related tools