convertimate Floating point (IEEE 754)

IEEE 754 floating-point converter

0.1 cannot be stored exactly in binary: a 32-bit float holds 0.100000001490116…. Convert a decimal to its float32 or float64 bits, or paste hex bits to read the number inside.

3DCCCCCDfloat32 hex

A 32-bit float cannot hold 0.1 exactly: it stores 0.10000000149, a relative error of 1.5e-8.

Quick reference

Common numbers as float32 and float64 bits

decfloat32 hexfloat64 hexfloat32
0.13DCCCCCD3FB999999999999A0.100000001
0.23E4CCCCD3FC999999999999A0.200000003
0.33E99999A3FD33333333333330.300000012
0.53F0000003FE00000000000000.5
13F8000003FF00000000000001
-1BF800000BFF0000000000000-1
24000000040000000000000002
3.1415926535897940490FDB400921FB54442D113.14159274
1041200000402400000000000010
10042C800004059000000000000100
167772164B800000417000000000000016777216
167772174B800000417000001000000016777216

What it means

Where does it sit in the float range?

Uses round-to-nearest, as every processor does by default. The binary form shows sign, exponent and fraction separated by spaces.

Every unit

That number in every format

Good to know

Why 0.1 + 0.2 is not exactly 0.3

A floating-point number is stored as a sign, an exponent and a binary fraction. Fractions whose denominator is a power of two (0.5, 0.25, 0.375) are exact; most decimal fractions are not, because 0.1 in binary repeats forever like 1/3 in decimal. The computer keeps the nearest value it can: 0.1 becomes 0.100000001490116 in float32 and 0.1000000000000000055 in float64.

Float32 has 24 bits of precision, about 7 decimal digits, so every whole number up to 16,777,216 is exact and 16,777,217 is not. Float64 has 53 bits, about 16 digits, exact up to 9,007,199,254,740,992. Compare floats with a small tolerance instead of ==, and use integers (cents, not euros) for money.

Learn

Three things worth knowing

Keep going

What people use next

Shortcuts

Popular number conversions

Background

About floating point

A float stores a number as sign × 1.fraction × 2exponent. A 32-bit float has 1 sign bit, 8 exponent bits and 23 fraction bits, about 7 significant digits; a 64-bit double has 11 and 52, about 16 digits.

Most decimal fractions have no exact binary form, so they are rounded: 0.1 is really 0.100000001490116… as a float and 0.1000000000000000055… as a double. That is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.

Embed this converter