IEEE 754 Binary Converter
Convert decimal numbers to IEEE 754 binary or decode IEEE 754 bit patterns back to decimal. Analyze the sign bit, biased exponent, fraction field, unbiased exponent, hexadecimal representation, number classification and precision format.
Decimal to IEEE 754 Binary
Encode a decimal value into its actual IEEE 754 stored bit pattern.
IEEE 754 Binary to Decimal
Decode a complete 32-bit or 64-bit IEEE 754 bit pattern.
What Is IEEE 754 Floating-Point?
IEEE 754 is a widely used standard for representing floating-point numbers in computers. Instead of storing a binary number as a simple integer and fraction, IEEE 754 divides the bit pattern into a sign field, exponent field and fraction field.
The exponent is stored using a bias rather than as an ordinary signed integer. Normal finite numbers also use an implicit leading binary digit, allowing one extra bit of effective significand precision without physically storing that bit.
The standard also reserves special bit patterns for positive and negative zero, subnormal numbers, positive and negative infinity, and NaN values.
IEEE 754 Single vs Double Precision
| Property | 32-bit Single Precision | 64-bit Double Precision |
|---|---|---|
| Total bits | 32 | 64 |
| Sign bits | 1 | 1 |
| Exponent bits | 8 | 11 |
| Fraction bits | 23 | 52 |
| Exponent bias | 127 | 1023 |
| Effective significand precision | 24 binary digits for normal values | 53 binary digits for normal values |
| Approximate decimal precision | About 7 significant digits | About 15 to 17 significant digits |
How IEEE 754 Bit Fields Work
Sign Bit
A sign bit of 0 represents a positive value, while a sign bit of 1 represents a negative value.
Exponent Field
The exponent field stores a biased exponent. For normal single-precision values the true exponent is the stored exponent minus 127.
Fraction Field
For normal numbers, IEEE 754 assumes an implicit leading 1 before the binary fraction field.
Number Classification
Exponent and fraction combinations determine whether the value is normal, subnormal, zero, infinity or NaN.
IEEE 754 Normal Number Formula
For a normal finite IEEE 754 binary floating-point value:
The fraction represents the sum of the fraction bits using binary place values such as 2^-1, 2^-2, 2^-3 and so on.
IEEE 754 Special Value Patterns
| Exponent Field | Fraction Field | Classification | Meaning |
|---|---|---|---|
| All zeros | All zeros | Zero | Positive or negative zero depending on sign |
| All zeros | Nonzero | Subnormal | Very small finite number without implicit leading 1 |
| Neither all zero nor all one | Any | Normal | Ordinary finite floating-point value |
| All ones | All zeros | Infinity | Positive or negative infinity |
| All ones | Nonzero | NaN | Not-a-Number |
Worked Example 1: Decimal 13.25 to IEEE 754 Single Precision
Decimal 13.25 can be represented exactly in binary.
Worked Example 2: Decode 32-bit IEEE 754
Worked Example 3: Negative IEEE 754 Number
For decimal -7.5:
Worked Example 4: Decimal 0.1 and Rounding
Decimal 0.1 does not have a finite binary expansion. Its binary representation repeats, so IEEE 754 must store a rounded approximation.
Why IEEE 754 Uses an Exponent Bias
IEEE 754 exponent fields are unsigned binary fields. A bias allows both positive and negative mathematical exponents to be represented without a separate exponent sign bit.
| Format | Exponent Bits | Bias | Example Stored Exponent | True Exponent |
|---|---|---|---|---|
| Single | 8 | 127 | 130 | 3 |
| Single | 8 | 127 | 125 | -2 |
| Double | 11 | 1023 | 1026 | 3 |
| Double | 11 | 1023 | 1021 | -2 |
Normal vs Subnormal IEEE 754 Numbers
Normal Numbers
Normal numbers have a nonzero, non-all-ones exponent field and use an implicit leading binary 1 in the significand.
Subnormal Numbers
Subnormal numbers use an all-zero exponent field and a nonzero fraction. They do not use the normal implicit leading 1, allowing representation of values closer to zero.
Single vs Double Precision Accuracy
Increasing the fraction field from 23 stored bits in single precision to 52 stored bits in double precision dramatically improves numerical precision.
| Feature | Single Precision | Double Precision |
|---|---|---|
| Storage | 32 bits | 64 bits |
| Fraction field | 23 bits | 52 bits |
| Effective normal significand | 24 bits | 53 bits |
| Approximate decimal digits | About 7 | About 15 to 17 |
| Memory use | Lower | Higher |
| Typical precision | Moderate | High |
Common IEEE 754 Single-Precision Examples
| Decimal | IEEE 754 Hex | Classification |
|---|---|---|
| 0 | 0x00000000 | Positive zero |
| -0 | 0x80000000 | Negative zero |
| 1 | 0x3F800000 | Normal |
| -1 | 0xBF800000 | Normal |
| 2 | 0x40000000 | Normal |
| 0.5 | 0x3F000000 | Normal |
| 13.25 | 0x41540000 | Normal |
| Positive Infinity | 0x7F800000 | Infinity |
| Negative Infinity | 0xFF800000 | Infinity |
IEEE 754 vs General Binary Floating-Point
| Feature | IEEE 754 | General Binary Floating-Point Notation |
|---|---|---|
| Purpose | Computer storage standard | Mathematical representation |
| Sign | Dedicated sign bit | Usually written with + or – |
| Exponent | Biased stored field | Ordinary signed exponent |
| Significand | Fraction field plus implicit leading bit for normals | Written explicitly |
| Special values | Zero, subnormal, infinity and NaN | Not inherently defined |
Important IEEE 754 Considerations
This is expected behavior and is one reason calculations such as decimal 0.1 plus 0.2 can produce a value extremely close to, but not mathematically identical to, 0.3 in binary floating-point systems.
Also remember that 32-bit single precision and 64-bit double precision can produce different stored approximations because they use different numbers of exponent and fraction bits.