Change Number's Mantissa
Decompose IEEE 754 floating-point numbers to modify the mantissa (significand) bits directly. Visualize sign, exponent, and mantissa in binary.
About
Every floating-point number stored in a computer follows the IEEE 754 standard. A 64-bit double-precision float is partitioned into three fields: 1 sign bit, 11 exponent bits, and 52 mantissa (significand) bits. Misunderstanding this layout causes silent precision errors in financial calculations, physics simulations, and hash-dependent systems. This tool performs real binary decomposition using ArrayBuffer and DataView, letting you inspect and replace the mantissa fraction bits of any double-precision number. The result is a genuinely reassembled IEEE 754 value, not a textual approximation.
Note: the mantissa field stores only the fractional part. IEEE 754 normal numbers assume an implicit leading 1 bit (the "hidden bit"), so the true significand is 1.f where f is the stored 52-bit fraction. Subnormal numbers (exponent all zeros) lack this hidden bit. This tool preserves exponent and sign while swapping only the fraction bits. Values outside the 52-bit range are truncated from the right.
Formulas
An IEEE 754 double-precision number v is composed from three binary fields:
For subnormal numbers (exponent field = 0):
Where s = sign bit (0 or 1), e = biased exponent (unsigned 11-bit integer, 0 - 2047), m = mantissa fraction (unsigned 52-bit integer, 0 - 252−1). This tool keeps s and e intact while replacing m with a user-supplied 52-bit binary string.
Reference Data
| Field | Bits | Position | Range / Purpose |
|---|---|---|---|
| Sign | 1 | Bit 63 | 0 = positive, 1 = negative |
| Exponent | 11 | Bits 62 - 52 | Biased by 1023; range 0 - 2047 |
| Mantissa (fraction) | 52 | Bits 51 - 0 | Fractional significand bits |
| Exponent 0 | Subnormal number (no hidden bit) or ±0 | ||
| Exponent 2047 | ±∞ (mantissa 0) or NaN (mantissa ≠ 0) | ||
| Smallest subnormal | 5 × 10−324 | ||
| Largest subnormal | ≈ 2.225 × 10−308 | ||
| Smallest normal | 2.2250738585072014 × 10−308 | ||
| Largest finite | 1.7976931348623157 × 10308 | ||
| Machine epsilon | 2−52 ≈ 2.22 × 10−16 | ||
| Precision (decimal) | 15 - 17 significant digits | ||
| Bias | 1023 | ||
| Hidden bit | Implicit 1 for normal numbers | ||
| NaN payload | Any non-zero mantissa with exponent 2047 | ||
| Quiet NaN | Bit 51 of mantissa = 1 | ||
| Signaling NaN | Bit 51 = 0, remaining ≠ 0 | ||