IEEE 754 Floating Point Calculator

Convert decimal numbers to IEEE 754 single (32-bit) and double (64-bit) precision format.

About This Calculator

Convert decimal numbers to IEEE 754 single (32-bit) and double (64-bit) precision format. Use the calculator above for instant results.

Worked Examples

Example 1: 3.14

  • 32-bit: 40 48 F5 C3 | Stored: 3.14000010... (rounding!)
  • 64-bit: 40 09 1E B8 51 EB 85 1F | Stored: 3.14 (much closer)

Answer: 3.14 has rounding error

Example 2: 0.1 + 0.2

  • 0.1 in float = 0.100000001490... | 0.1+0.2 ≠ 0.3 exactly
  • Famous floating point bug: 0.1+0.2 = 0.30000000000000004 in JS

Answer: 0.1 not exactly representable

Example 3: -1.5

  • 32-bit: BF C0 00 00 | Exact representation
  • Powers of 2 and their halves are exact in IEEE 754

Answer: Exact — power of 2

Who Uses This Calculator?

💻
CS Students

Understand floating point representation.

🧪
Programmers

Debug floating point precision issues.

🏫
CS Teachers

IEEE 754 standard demonstrations.

🔧
Embedded Engineers

Verify float representation in microcontrollers.

Common Mistakes to Avoid

❌ 0.1 + 0.2 != 0.3 in most languages

This is not a bug in the language — it is a fundamental property of binary floating point. 0.1 cannot be exactly represented in binary.

❌ Float vs double precision

Float (32-bit): ~7 decimal digits. Double (64-bit): ~15-16 decimal digits. Always use double unless memory/performance is critical.

Frequently Asked Questions

Why can't 0.1 be represented exactly?

0.1 in binary is 0.0001100110011... (repeating). Like 1/3 in decimal, some fractions repeat in binary and must be rounded.

When does floating point cause bugs?

Financial calculations (use integer cents or Decimal type). Equality comparisons (never ==, use |a-b| < epsilon). Accumulating many small additions.

IEEE 754 special values?

Infinity (1/0), -Infinity (-1/0), NaN (0/0 or sqrt(-1)), -0. These are standardized across all IEEE 754 implementations.