No Login Data Private Local Save

Decimal to IEEE 754 Converter - Online Float Representation

18
0
0
0
Quick:
IEEE 754 Bit Representation
Sign (1 bit) Exponent (8 bits) Mantissa (23 bits)
MSB (most significant bit)  |  LSB (least significant bit)
Hexadecimal
Big-endian (network byte order)
Binary
Sign Bit
Value
0 = positive, 1 = negative
Exponent
Stored Value (biased)
Bias
Actual Exponent
Mantissa (Fraction)
Raw Mantissa Bits
Implicit Leading Bit
Fractional Value (binary 0.xxx)
Reconstruction Formula
Actual Stored Decimal Value:
Frequently Asked Questions
What is IEEE 754?
IEEE 754 is the international standard for floating-point arithmetic, established by the Institute of Electrical and Electronics Engineers (IEEE). It defines how real numbers are represented in binary form within computer systems. The standard specifies several formats—most commonly binary16 (half precision, 16 bits), binary32 (single precision, 32 bits), and binary64 (double precision, 64 bits). Each format partitions bits into three fields: a sign bit, an exponent (with bias), and a mantissa (fraction). This standard ensures consistent behavior across different hardware and programming languages.
Why does 0.1 + 0.2 ≠ 0.3 in many programming languages?
The decimal number 0.1 has no exact finite binary representation—it is a repeating binary fraction (0.0001100110011...₂). When stored in IEEE 754 format, it must be rounded to the available mantissa bits. Similarly, 0.2 is also rounded. Adding these two approximations yields a result slightly different from the binary approximation of 0.3. The discrepancy (about 5.55e-17 for float64) is a natural consequence of finite precision. This is not a bug—it's an inherent property of binary floating-point representation, analogous to how 1/3 cannot be exactly represented as a finite decimal (0.333...).
What is the exponent bias and why is it used?
The exponent bias is a constant added to the actual exponent to obtain the stored exponent, which is always an unsigned (non-negative) integer. For float32, the bias is 127; for float64, 1023; for float16, 15. This technique allows the exponent to represent both positive and negative values without using two's complement, simplifying hardware comparison and sorting. For example, in float32, a stored exponent of 0 means the actual exponent is -127 (used for subnormal numbers and zero), while a stored exponent of 254 means the actual exponent is +127. Stored exponents of all-0s and all-1s are reserved for special values (zero, subnormals, infinity, NaN).
What are normalized vs. subnormal (denormalized) numbers?
Normalized numbers use an implicit leading 1 before the binary point in the mantissa (i.e., the value is 1.m × 2^exp). The exponent field is neither all-0s nor all-1s. This is the most common case.

Subnormal numbers occur when the exponent field is all-0s but the mantissa is non-zero. They use an implicit leading 0 (i.e., 0.m × 2^1-bias) and allow representation of values closer to zero than the smallest normalized number. This is called gradual underflow and prevents a sudden gap around zero. Without subnormals, the gap between 0 and the smallest normalized float32 value (±1.175e-38) would be a mathematical discontinuity.
What are NaN and Infinity in IEEE 754?
Infinity (∞) is represented by an exponent of all-1s and a mantissa of all-0s. The sign bit determines positive (+∞) or negative (-∞) infinity. Infinity results from operations like 1/0 or overflow beyond the maximum representable value.

NaN (Not a Number) is represented by an exponent of all-1s and a non-zero mantissa. NaN results from undefined operations like 0/0, ∞-∞, or sqrt(-1). There are two types: quiet NaN (qNaN, the most significant mantissa bit is 1) which propagates through calculations without raising exceptions, and signaling NaN (sNaN, MSB of mantissa is 0) which triggers an exception when used. NaN is the only value where x ≠ x evaluates to true.
How much precision do I lose with float16 vs float32?
Float16 (half precision) has only 10 mantissa bits, providing about 3-4 significant decimal digits of precision. Its maximum representable value is approximately 65,504. Float16 is mainly used in GPU computing, machine learning (mixed-precision training), and image processing where memory bandwidth is critical.

Float32 (single precision) has 23 mantissa bits, yielding about 7 significant decimal digits. Its maximum value is approximately 3.4 × 10³⁸. Float32 is the workhorse of general-purpose computing.

Float64 (double precision) has 52 mantissa bits, providing about 15-17 significant decimal digits. Its maximum value is approximately 1.8 × 10³⁰⁸. Float64 is the default in JavaScript, Python, and most scientific computing.
Why is -0 a thing in IEEE 754?
IEEE 754 distinguishes between +0 and -0 (all bits zero except the sign bit). While they compare equal (+0 === -0 in most languages), they behave differently in certain operations. For example, 1/+0 = +∞ while 1/-0 = -∞. This distinction is useful for preserving the sign of underflowed negative values and for complex branch cuts in mathematical functions. The sign of zero can also indicate the direction from which a limit approached zero. You can test for -0 using Object.is(x, -0) in JavaScript or by checking 1/x === -Infinity.