By Debmedia Technologies LLP · Kolkata, India · Updated
What Is It and When Do You Need It?
Floating point numbers are stored in binary with a sign, an exponent and a mantissa. This explains why 0.1 + 0.2 is not exactly 0.3 in most programming languages.
Enter a decimal to see its bits, or paste hex bits to see the number they mean.
How to Use This Tool
- Enter a number, or hex bits.
- Choose 32 or 64 bit.
- Choose whether the input is decimal or hex.
- Press Convert.
How the Calculation Works
The number is written into a binary buffer as a float or a double, and the bytes are read back. The sign is the first bit, the exponent is the next group (biased by 127 or 1023), and the mantissa holds the fraction after an implied leading 1. The stored value is shown with full precision to reveal rounding.
Worked Example
0.1 as a 32-bit float is 0x3DCCCCCD: sign 0, exponent 01111011 (123, so 2 to the power −4) and mantissa 10011001100110011001101. Its stored value is 0.10000000149011612.
Common Uses
- Debugging rounding errors.
- Binary protocols and file formats.
- Teaching floating point.
- Reading memory dumps.
Tips and Common Mistakes
- Never compare floats with equals.
- Use integers for money.
- Doubles have about 15 to 16 digits of precision.
Related Tools
Next, you may need the bitwise calculator, checksum calculator, ASCII table, Base32 encoder.
Everything runs in your browser. Nothing you type is uploaded, stored or sent to any outside service.
Frequently Asked Questions
Disclaimer: results are calculated in your browser from the numbers you enter. Check important results before you rely on them for money, health, safety or legal decisions.