Skip to the tool
Binary Translator Free tools

IEEE 754 floating-point converter

An IEEE 754 converter for single (32-bit) and double (64-bit) precision. Type a decimal number to see its float bits, the exact value stored and how far it is from what you typed. Click any bit to flip it.

Updated · Written and checked by Murugan Vellaichamy

Waiting for input

SignExponentSignificandClick a bit to flip it.

Try:

How a float is laid out

A binary32 float is 1 sign bit, 8 exponent bits and 23 significand bits; binary64 uses 1, 11 and 52. For a normal number the value is (−1)sign × 1.significand × 2exponent − bias, where the bias is 127 for binary32 and 1023 for binary64.

An exponent field of all zeros means zero or a subnormal number (no hidden leading 1, used for values very close to zero). All ones means infinity when the significand is zero, and NaN otherwise.

Numberbinary32 (hex)binary64 (hex)
13F8000003FF0000000000000
0.13DCCCCCD3FB999999999999A
−2C0000000C000000000000000
0.53F0000003FE0000000000000
10042C800004059000000000000

Why 0.1 + 0.2 isn’t exactly 0.3

0.1 has no exact binary form, just as 1/3 has no exact decimal form. The float stores the nearest value it can, which for binary64 is a little more than 0.1. Adding two of these tiny errors gives a result one step away from the float nearest to 0.3. Type 0.1 into the converter to see the exact value stored and the error.

Sources and method

Values come from your browser’s own IEEE 754 hardware (JavaScript DataView), so they match what real programs store. The exact stored value and the error are worked out with exact arithmetic.

Questions

What is the difference between float and double?

In most languages float is binary32 (about 7 significant decimal digits) and double is binary64 (about 15 to 17).

What is a subnormal number?

A value smaller than the smallest normal number, stored with an exponent field of zero and no hidden 1. It trades precision for range near zero.

Why are there two zeros?

The sign bit is separate, so +0 and −0 both exist. They compare as equal, but 1/−0 gives −infinity.

More converters

Copied