Floating-Point Calculator
Convert decimal numbers to IEEE 754 floating-point representation. Understand how numbers are stored in binary format (32-bit or 64-bit).
How to Use This Calculator
- Enter a decimal number (positive or negative).
- Select precision: 32-bit (single precision) or 64-bit (double precision).
- The calculator displays the IEEE 754 representation: sign bit, exponent, mantissa, and hexadecimal.
- Use this to understand how computers store floating-point numbers or debug numerical issues.
IEEE 754 Format
IEEE 754 floating-point numbers are stored in three parts:
64-bit: [Sign 1 bit][Exponent 11 bits][Mantissa 52 bits]
Number = (-1)^Sign × (1.Mantissa) × 2^(Exponent - Bias)
Bias = 127 (32-bit) or 1023 (64-bit)
Example: 3.14159 in 32-bit: Sign = 0 (positive), normalized to 1.570795 × 2¹, Exponent = 128 (1 + 127), Mantissa = binary representation of 0.570795.
Full Description
IEEE 754 is the standard for representing floating-point numbers in computers. It allows computers to store a wide range of numbers (from very small to very large) with varying precision. Understanding IEEE 754 is essential for anyone working with numerical computing, as it explains how numbers are actually stored and why some calculations may have precision limitations.
The format uses three components: a sign bit (positive or negative), an exponent (power of 2), and a mantissa (the significant digits). Numbers are normalized to the form 1.xxxxx × 2^exponent, which allows efficient storage. The exponent is stored with a bias to allow both positive and negative exponents. 32-bit (single precision) provides about 7 decimal digits of precision, while 64-bit (double precision) provides about 15-17 decimal digits.
This calculator helps you understand IEEE 754 representation. Enter a decimal number and select precision, and it shows the sign bit, exponent, mantissa, and hexadecimal representation. Use it to learn how floating-point numbers work, debug numerical issues, understand precision limitations, or verify how specific numbers are stored. Understanding IEEE 754 is fundamental to numerical computing and programming.
Frequently Asked Questions
What is IEEE 754 floating-point?
IEEE 754 is the standard for representing floating-point numbers in computers. It uses three parts: sign bit (1 bit), exponent (8 bits for 32-bit, 11 bits for 64-bit), and mantissa (23 bits for 32-bit, 52 bits for 64-bit). This allows representing a wide range of numbers with varying precision.
What's the difference between 32-bit and 64-bit?
32-bit (single precision) uses 1 sign + 8 exponent + 23 mantissa = 32 bits. Range: ~±3.4×10³⁸, precision: ~7 decimal digits. 64-bit (double precision) uses 1 sign + 11 exponent + 52 mantissa = 64 bits. Range: ~±1.7×10³⁰⁸, precision: ~15-17 decimal digits.
How is the exponent calculated?
The number is normalized to 1.xxxxx × 2^exponent form. The exponent is stored with a bias (127 for 32-bit, 1023 for 64-bit) to allow both positive and negative exponents. Actual exponent = Stored exponent - Bias.
What are special values?
IEEE 754 defines special values: +0 and -0 (all zeros), +Infinity and -Infinity (exponent all 1s, mantissa all 0s), NaN (Not a Number, exponent all 1s, mantissa non-zero). These allow handling edge cases like division by zero.