Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Most modern floating-point values use an IEEE 754 binary format. The bits are divided into a sign, a biased exponent, and a trailing significand (often called a mantissa). For normal values, the significand has an implicit leading 1 that is not stored. Binary32 occupies 32 bits; binary64 occupies 64 bits. Special exponent patterns represent zero, subnormal numbers, infinity, and NaN.

The three fields in an IEEE binary floating-point value

A floating-point encoding is binary scientific notation. A normal value is interpreted as:

value = (−1)sign × 1.significand × 2(stored exponent − bias)

  • Sign: one bit. Zero means positive and one means negative.
  • Exponent: an unsigned field stored with a bias so that both negative and positive powers of two can be represented.
  • Trailing significand: the fraction bits after the binary point. For a normal value, the leading 1 is implicit rather than stored.

IEEE-oriented documents, including NIST’s Digital Library of Mathematical Functions, use significand. “Mantissa” remains common programming terminology, but it is less precise for this binary representation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Binary32, binary64, and binary128 layouts

Format Total bits Sign bits Exponent bits Stored trailing significand Normal-value precision Exponent bias
binary32 (often single precision) 32 1 8 23 24 significant bits 127
binary64 (often double precision) 64 1 11 52 53 significant bits 1023
binary128 128 1 15 112 113 significant bits not stated in the cited summary; NIST gives exponent bounds of −16382 through +16383

“24 significant bits” in binary32 means 23 fraction bits plus the implicit leading 1. Binary64 similarly has 52 stored fraction bits plus that implicit bit. A programming-language type name does not, by itself, guarantee one of these formats: check the language and implementation. Java’s specification explicitly associates float with binary32 and double with binary64.

Decoding a normal value

  1. Read the sign bit and determine whether the result is positive or negative.
  2. Interpret the exponent field as an unsigned integer.
  3. Subtract the format’s bias (127 for binary32 or 1023 for binary64).
  4. Put the implicit leading 1 before the stored fraction bits to form the significand.
  5. Multiply that significand by the resulting power of two and apply the sign.

Example: binary32 encoding of 2

Microsoft’s binary32 example for the number 2 is 01000000000000000000000000000000, or 0x40000000. The sign is 0, the stored exponent is 128, and 128 − 127 gives an actual exponent of 1. The fraction field is all zeros, so the significand is exactly 1. The decoded value is therefore +1 × 21 = 2.

What the reserved exponent patterns mean

The ordinary formula applies only when the exponent is neither all zeros nor all ones. Those two patterns provide encodings that ordinary finite numbers cannot represent.

Zero

An all-zero exponent and an all-zero fraction encode zero. The sign bit is retained, so IEEE formats have both +0 and −0. They compare as zero in many operations, but the sign can affect some results and functions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Subnormal numbers

An all-zero exponent with a nonzero fraction encodes a subnormal (also called denormal) value. Its leading significand bit is 0 rather than the normal value’s implicit 1. Subnormals extend the representable range below the smallest normal magnitude, at the cost of fewer effective significant bits near zero.

Infinity

An all-one exponent with a zero fraction encodes positive or negative infinity, according to the sign bit. Infinity is a special non-finite value, not an ordinary very large finite real number.

NaN

An all-one exponent with a nonzero fraction encodes NaN (“not a number”). NaNs represent invalid or undefined results and can carry implementation-specific payload information. Their exact behavior in comparisons and propagation depends on the operation and language rules.

Why decimal values such as 0.1 are not usually exact

A finite binary fraction can represent only values whose required denominator is a power of two. Many finite decimal fractions, including 0.1, do not have a finite binary expansion. Converting such a decimal to binary32 or binary64 therefore rounds it to the nearest representable value (subject to the selected rounding rule).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The rounded bits are the stored value. A language’s default decimal formatting may print a short, familiar value such as 0.1 even though the stored binary value is slightly different; display text is not a dump of every stored bit. Calculations can expose the difference through accumulated operations, comparisons, or conversions back to decimal.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Bit fields are not the same as bytes in memory

The sign–exponent–fraction diagram describes the numerical bit pattern, not necessarily the order of bytes you will see in RAM or a file. A processor may store the bytes in little-endian or big-endian order, and a file or network protocol can impose its own representation.

RFC 1832’s XDR specification illustrates this distinction: its bit-position numbering is a mathematical description of the external encoding, not a universal claim about physical locations on every machine. To decode raw bytes correctly, establish all three facts first:

  • which floating-point format is being used (for example, binary32 or binary64);
  • the byte order of the memory dump, file, or protocol;
  • any language-runtime or file-format rules that transform the value.

Only after those choices are known should you combine the bytes into a bit pattern and split out the fields. A debugger showing a reversed-looking hexadecimal word may simply be displaying a little-endian byte sequence.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What binary32 versus binary64 changes

Property Binary32 Binary64
Storage per value 32 bits (4 bytes) 64 bits (8 bytes)
Significant bits for normal values 24 53
Exponent field 8 bits, bias 127 11 bits, bias 1023
Practical consequence Less precision and range, with lower storage cost More precision and range, with twice the storage width

Choosing between them is an application decision: numerical error tolerance, range, memory and bandwidth limits, file compatibility, and hardware support all matter. The labels “float” and “double” are not universal guarantees outside a specified language and implementation.

A reliable way to inspect a floating-point value

  1. Identify the producer: language, compiler/runtime, processor, file format, or network protocol.
  2. Confirm whether the value is binary32, binary64, or another format.
  3. Determine byte order before interpreting a sequence of bytes.
  4. Assemble the bits into the format’s fixed-width pattern.
  5. Extract sign, exponent, and fraction fields using that format’s field widths.
  6. Check reserved exponent cases before applying the normal-value formula.
  7. For a normal value, subtract the bias and restore the implicit leading 1; for a subnormal, use a leading 0.

Key points

  • Common IEEE binary floats are sign, biased exponent, and trailing significand fields.
  • Binary32 uses 32 bits and 24 bits of normal precision; binary64 uses 64 bits and 53 bits.
  • The exponent bias lets an unsigned field encode negative and positive exponents.
  • Normal values omit a leading significand 1; subnormals use a leading 0.
  • Signed zero, infinity, and NaN are defined encodings, not ordinary finite numbers.
  • A numerical bit layout does not determine the byte order seen in memory or serialization.