What Is Binary Floating-Point Addition?
Binary floating-point arithmetic represents a number using a sign, an exponent and a significand. IEEE 754 defines widely used formats for storing these numbers and specifies how basic arithmetic results are rounded when they cannot be represented exactly. Read an IEEE 754 background guide.
This calculator adds two operands in either binary32 single precision or binary64 double precision. In decimal input mode, each operand is first converted to the selected format, and the two represented values are added. The result is then rounded to that format.
How IEEE 754 Stores a Number
Each supported format divides its bits into three fields:
- Sign: one bit indicating a positive or negative value.
- Exponent: a biased exponent that scales the significand by a power of two.
- Fraction: the stored fractional significand bits. Normalized values have an implicit leading 1.
| Property | Binary32 | Binary64 |
|---|---|---|
| Total bits | 32 | 64 |
| Sign bits | 1 | 1 |
| Exponent bits | 8 | 11 |
| Fraction bits | 23 | 52 |
| Exponent bias | 127 | 1023 |
| Approximate decimal precision | 7 significant digits | 15–16 significant digits |
How Floating-Point Addition Works
Conceptually, floating-point addition involves aligning the operands' exponents, adding or subtracting their significands according to their signs, normalizing the result when necessary, and rounding to the selected precision. Hardware performs these steps according to the floating-point format's arithmetic rules.
- Decode: identify each operand's sign, exponent and significand.
- Align: express the significands at a common exponent.
- Add or subtract: combine the significands, taking account of the operand signs.
- Normalize: adjust the significand and exponent to the appropriate form.
- Round: store the result using the precision and range of the selected format.
The calculator displays a conceptual breakdown and the actual bit representation. It does not claim to expose the processor's internal guard, round and sticky bits or every hardware micro-operation.
Why Is 0.1 + 0.2 Not Always Exactly 0.3?
Many decimal fractions have repeating binary expansions. Because binary32 and binary64 have a finite number of significand bits, values such as 0.1 and 0.2 are generally stored as nearby representable numbers rather than their exact decimal values.
The addition therefore operates on the stored approximations. The displayed result depends on the selected precision. This is normal floating-point behavior, not necessarily a calculator error.
Single Precision Versus Double Precision
Binary32 uses 32 bits and is often used where memory or bandwidth is important. Binary64 uses 64 bits and normally provides substantially more precision and a wider exponent range. Neither format can exactly represent every real number.
If a value is already represented in binary32, converting it to binary64 preserves that binary32 value exactly. It does not recover decimal information lost when the original value was first rounded to binary32.
Using Raw Binary or Hexadecimal Input
Choose raw hexadecimal or binary mode to inspect existing IEEE 754 encodings. A binary32 pattern contains exactly 32 bits or 8 hexadecimal digits; a binary64 pattern contains exactly 64 bits or 16 hexadecimal digits. In these modes, the calculator decodes each bit pattern and adds the represented values in the selected format.
Binary32 example: 2.25 = 0x40100000
Sum: 3.75 = 0x40700000
Special Values
IEEE 754 also supports positive and negative zero, subnormal values, positive and negative infinity, and NaN (Not a Number). These values have special exponent and fraction patterns. The calculator identifies the decoded result classification when applicable.