IEEE 754 Floating-Point Converter

Explore how decimal values are represented in IEEE 754 single- and double-precision formats, with clear bit fields and conversion explanations.

Presets:
Hexadecimal
41540000
Stored Decimal Value
13.25
Classification
Normal
Bit Field Breakdown (32-bit)
Sign Field (1 bit)
0
Meaning: + (Positive)
Biased Exponent (8 bits)
10000010
Stored: 130₁₀
Unbiased: 3 (Bias: 127)
Fraction / Mantissa (23 bits)
10101000000000000000000
Significant: 1.10101000...
Full 32/64-Bit Memory Representation:
0 10000010 10101000000000000000000

Evaluation Steps

Formula: (-1)^0 × (1.10101000000000000000000)₂ × 2^(3)
  • 1Sign bit = 0 (positive).
  • 2Biased exponent (10000010₂) = 130₁₀.
  • 3Unbiased exponent: 130 - 127 = 3.
  • 4Normal significand uses implicit leading 1: (1.10101000...)₂.
  • 5Integer part 13 in binary: 1101₂.
  • 6Fractional part approx 0.250000 converted to binary expansion.
  • 7Normalized form: 1.1010100000... × 2^3.
  • 8Biased exponent: 3 + 127 = 130 (10000010₂).

What Is IEEE 754?

IEEE 754 is a standard for representing and working with floating-point numbers in computing systems.

Unlike integers, floating-point numbers need to represent values with fractional parts and a wide range of magnitudes. IEEE 754 formats achieve this by dividing a binary representation into a sign field, an exponent field and a fraction field.

Two commonly used formats are binary32, often called single precision, and binary64, commonly called double precision.

Floating-point representation is not the same as exact decimal arithmetic. Some decimal fractions cannot be represented precisely using a finite number of binary bits. The closest representable value is stored instead.

Understanding Sign, Exponent and Fraction Bits

A normal finite binary floating-point number is interpreted using:

(-1)sign × (1 + fraction) × 2(exponent − bias)

Here, fraction means the fractional binary value encoded in the fraction field.

This formula applies to normal values. Subnormal numbers, zero, infinity and NaN require different interpretation.

Sign

The sign bit determines whether the represented value is positive (0) or negative (1).

Exponent

The exponent field determines the scale of the number through an unsigned biased power of two.

Fraction

The fraction field stores the significant fractional bits. Normal numbers also have an implicit leading 1.

Comparison of IEEE 754 binary32 and binary64 sign, exponent and fraction field sizes.
Figure 1: Field sizes and bit layouts for IEEE 754 binary32 (single precision) and binary64 (double precision).

IEEE 754 Single Precision — 32 Bits

Binary32 uses 32 bits arranged into three fields:

FieldBits
Sign1
Exponent8
Fraction23
Total32

The exponent bias is 127.

Binary32 has approximately seven significant decimal digits of precision, although exact accuracy depends on the value.

IEEE 754 Double Precision — 64 Bits

Binary64 uses 64 bits arranged into three fields:

FieldBits
Sign1
Exponent11
Fraction52
Total64

The exponent bias is 1023.

Binary64 typically provides approximately 15–17 significant decimal digits.

Using more bits provides greater precision and a wider exponent range, but it does not make every decimal fraction exactly representable.

Step-by-Step IEEE 754 Conversion

Worked Example: Convert 13.25 to IEEE 754 Binary32

Start with decimal: 13.25

Convert the integer part: 13 = 1101 in binary.

Convert the fractional part: 0.25 = 0.01 in binary.

Combine them: 13.25 = 1101.01

Normalize: 1.10101 × 2³

The number is positive, so: Sign = 0

The exponent is 3. Add the binary32 bias: 3 + 127 = 130

130 in binary: 10000010

The fractional bits after the leading 1 are: 10101

Pad the fraction field to 23 bits: 10101000000000000000000

Final Representation

Sign: 0
Exponent: 10000010
Fraction: 1010100...
Complete binary32 value: 01000001010101000000000000000000
Hexadecimal: 41540000

This example is exactly representable because 0.25 is a power-of-two fraction.

Why Decimal Fractions Sometimes Change

Consider decimal 0.1.

It looks simple in base 10, but its binary fractional representation repeats indefinitely.

A 32-bit floating-point format cannot store every repeating bit, so it rounds the value to the nearest representable binary32 number under the normal round-to-nearest rule.

For positive 0.1, the binary32 hexadecimal encoding is: 3DCCCCCD

The corresponding stored value is approximately: 0.10000000149011612

In binary64, the hexadecimal representation is: 3FB999999999999A

This does not mean the computer is randomly changing numbers. It is a consequence of finite binary precision.

When comparing floating-point calculations, the appropriate tolerance depends on the problem. Exact equality is not always the right test for values produced through arithmetic.

Special IEEE 754 Values

Positive and Negative Zero

IEEE 754 distinguishes +0 and -0 using the sign bit. They compare equal in many ordinary numeric comparisons, but their sign can affect certain operations such as 1 / (-0) producing negative infinity.

Subnormal Numbers

Subnormal numbers represent very small nonzero magnitudes near zero. They use an exponent field of all zeros and do not have the implicit leading 1 used by normal numbers.

Infinity

Positive and negative infinity use an exponent field containing all ones and a fraction field containing all zeros.

NaN

NaN means Not a Number. NaN values have an exponent field of all ones and a nonzero fraction field. More than one bit pattern represents NaN.

Common IEEE 754 Conversion Mistakes

Forgetting the exponent bias: The stored exponent is not the same as the unbiased exponent. Remember to add 127 for binary32 or 1023 for binary64.

Assuming the leading 1 is explicitly stored: For normal binary32 and binary64 values, the leading 1 is implicit and not written into the fraction bits.

Treating decimal fractions as exactly representable: Values such as 0.1 usually require rounding because of infinite binary fractional expansion.

Applying the normal-number formula to subnormal values: Subnormal numbers use a different significand rule without the implicit leading 1.

Losing the sign of negative zero: Negative zero has a distinct bit pattern with the sign bit set to 1.

Frequently Asked Questions

What is the difference between 32-bit and 64-bit IEEE 754?

Binary64 uses more exponent and fraction bits, allowing a wider range of magnitudes and greater numerical precision than binary32.

Why is 0.1 not stored exactly?

Because 0.1 has an infinitely repeating binary fractional expansion. A finite binary32 or binary64 representation must approximate it.

What does the exponent bias do?

It allows the exponent field to encode negative and positive exponents using an unsigned stored value.

Can IEEE 754 represent infinity?

Yes. Both positive and negative infinity have dedicated encodings with all-ones in the exponent field and all-zeros in the fraction field.

Does IEEE 754 have only one NaN value?

No. Multiple bit patterns represent NaN, depending on the fraction field payload and signaling bits.

Explore companion calculators and converters for digital logic design, computer architecture, and number systems.