Convert decimal numbers to IEEE 754 floating-point binary and hexadecimal representations.Important: Decimal input is parsed as a JavaScript number, so the result is the IEEE 754 encoding of that parsed numeric value, not an arbitrary decimal-string encoding.
Last updated: March 2026 | By Patchworkr Team
IEEE 754 is the technical standard for floating-point arithmetic used by virtually all modern computers and programming languages. It defines how decimal numbers (including very large, very small, and fractional values) are represented in binary format.
Floating-point numbers consist of three components: a sign bit (positive or negative), an exponent (determines the magnitude), and a mantissa/significand (determines the precision). This format allows computers to represent a wide range of numbers using fixed memory sizes.
The two most common formats are Float32 (single precision, 32 bits) used when memory is limited or precision requirements are moderate, and Float64 (double precision, 64 bits) used for scientific computing and when higher precision is needed.
Convert the decimal number -12.375 to Float32:
0.1 in decimal is a repeating fraction in binary (0.000110011...), similar to how 1/3 = 0.333... in decimal. The mantissa has finite precision, so it's rounded, causing tiny errors. This is why (0.1 + 0.2) ≠ 0.3 in floating-point.
Use Float32 for graphics, games, and when memory/bandwidth is limited (saves 50% space). Use Float64 for scientific computing, financial calculations, or when you need ~16 digits of precision. Most languages default to Float64.
The bias (127 for Float32, 1023 for Float64) allows both positive and negative exponents to be stored as unsigned integers. This simplifies hardware comparison operations—larger bit patterns always represent larger numbers.
Normalized numbers always start with 1.xxxxx in binary, so the leading 1 is assumed and not stored, giving an extra bit of precision. The mantissa stores only the fractional part. Denormalized numbers (very near zero) don't have this implicit 1.
Use appropriate precision (Float64), avoid comparing for exact equality (use epsilon tolerance), be careful with accumulated errors in loops, consider decimal or rational libraries for exact decimal arithmetic (e.g., financial apps).
There are many possible NaN bit patterns (different mantissa values). Some systems use these to encode error types (quiet NaN vs signaling NaN). In practice, most languages treat all NaN values the same. NaN ≠ NaN by IEEE spec.
Technically, -0.0 and +0.0 have different bit patterns but compare as equal. Adding +0.0 converts -0.0 to +0.0. They're mainly relevant in edge cases like 1/(-0) = -∞ and 1/(+0) = +∞. Most code treats them identically.
Hexadecimal is more compact than binary (4 bits per digit) and exactly represents the bit pattern without any conversion ambiguity. It's commonly used in debugging, binary file formats, and low-level programming for precise bit-level control.
Related Tools
Generate .dockerignore files.
Convert between number systems.
Convert binary to hexadecimal.
Convert binary to octal.
Convert decimal to hexadecimal.
Convert decimal to octal.