A floating-point number stores a sign, an exponent and a significand, so that one format holds very large and very small numbers with the same relative precision. This lesson defines normalized binary scientific form, the IEEE 754 formats binary32 and binary64 with their biased exponents, their special values (signed zeros, subnormal numbers, infinities and NaN) and their range and precision, and proves why 0.1 cannot be stored exactly.
Letting the point float
A fixed-point format has the same step everywhere, so a small number keeps few significant bits and a large one may not fit at all (lesson 2.4). The remedy is to store with each number where its point belongs. Decimal numbers have a notation that does exactly this, scientific notation, and a floating-point number is its binary version. Both use powers with negative exponents.
For a number b other than 0 and a whole number k, b⁻ᵏ means 1bᵏ.[1] So 2⁻¹ = 12, 2⁻² = 14, 2⁻³ = 18, and 10⁻³ = 11,000 = 0.001. Together with b⁰ = 1 and the powers b¹, b², … (exponents as repeated multiplication), this gives a power bᴱ for every integer E.
For all integers a and b, 2ᵃ × 2ᵇ = 2ᵃ⁺ᵇ. In particular, for every integer E, 2ᴱ × 2 = 2ᴱ⁺¹ and 2ᴱ ÷ 2 = 2ᴱ⁻¹.
First the special case. For E ≥ 0, 2ᴱ × 2 = 2ᴱ⁺¹ is one more factor 2. For E = −k with k ≥ 1, 2⁻ᵏ × 2 = 22ᵏ = 12ᵏ⁻¹, which is 2⁻⁽ᵏ⁻¹⁾ = 2ᴱ⁺¹ (for k = 1 it is 1 = 2⁰). Dividing both sides of 2ᴱ × 2 = 2ᴱ⁺¹ by 2 gives 2ᴱ = 2ᴱ⁺¹ ÷ 2, the halving rule with E + 1 in place of E.
Now the general rule. If b ≥ 0, multiplying 2ᵃ by 2ᵇ means multiplying by 2, b times, and each time the exponent goes up by 1: the result is 2ᵃ⁺ᵇ. If b = −k with k ≥ 1, multiplying by 2⁻ᵏ = 12ᵏ means dividing by 2ᵏ, that is, dividing by 2, k times, and each time the exponent goes down by 1: the result is 2ᵃ⁻ᵏ = 2ᵃ⁺ᵇ. The same argument, with 10 in place of 2, gives 10ᵃ × 10ᵇ = 10ᵃ⁺ᵇ.
So multiplying by 2ᴱ moves the binary point E places to the right when E is positive and −E places to the left when E is negative, by Theorem 1 of lesson 2.4, as multiplying by 10ᴱ moves a decimal point (Decimals: multiplying and dividing by powers of ten). For whole exponents the rule 2ⁿ⁺ᵐ = 2ⁿ × 2ᵐ was already Theorem 2 of lesson 1.5.
A number is written in scientific notation when it has the form a × 10ⁿ with 1 ≤ a < 10 and n an integer.[2] For example, 45,000,000,000 = 4.5 × 10¹⁰ and 0.00032 = 3.2 × 10⁻⁴: a few digits, and a power of ten that says where the decimal point belongs. In this unit, “≈ 1.4 × 10⁻⁴⁵” gives a value rounded to the digits shown.
The rules of exponents for every base and every integer exponent are proved in the Mathematics unit Exponents; this lesson needs only Proposition 1.
Every positive number x can be written in exactly one way as x = s × 2ᴱ with an integer E and a significand s with 1 ≤ s < 2. When x has a binary numeral, s is that numeral with its point moved to just after the first 1: s = 1.b₁b₂b₃…₂.
Each power of 2 is twice the one before (Proposition 1). The powers 2⁰, 2¹, 2², … grow by at least 1 at each step, so some of them exceed x; the powers 2⁻¹, 2⁻², … are their reciprocals, so some of them lie below x. Hence there is a largest integer E with 2ᴱ ≤ x, and then x < 2ᴱ⁺¹. Then s = x ÷ 2ᴱ satisfies 1 ≤ s < 2, and no other E works, because for a larger E the quotient would be less than 1 and for a smaller one at least 2. Moving the point of x’s numeral to just after its first 1 divides by 2ᴱ (Proposition 1), and a numeral that begins “1.” lies between 1 and 2.
Write 13.25, 0.078125 and 6.75 in normalized binary form.
- 13.25 = 1101.01₂. Move the point 3 places left: 1.10101₂ × 2³. Check: 2³ = 8 ≤ 13.25 < 16.
- 0.078125 = 564 = 0.000101₂. Move the point 4 places right: 1.01₂ × 2⁻⁴. Check: 116 ≤ 0.078125 < 18.
- 6.75 = 110.11₂ = 1.1011₂ × 2².
Answer: 1.10101₂ × 2³, 1.01₂ × 2⁻⁴ and 1.1011₂ × 2². The exponent counts how far the point moved: left gives a positive E, right a negative one.
Theorem 2 is scientific notation in base 2. Stored this way, every number carries its own exponent, which fixes where its binary point really is; the point moves from number to number, hence the name floating point.[3]
Sign, exponent and significand
A computer’s floating-point format stores a number in normalized form, cut to a fixed number of digits. In it a real number has three parts, a sign, a significand and an exponent; the sign is a bit, 0 for positive and 1 for negative.[4]
A binary floating-point format has a precision p and a range of exponents from emin to emax. Its numbers are
± d₀.d₁d₂ … d₍ₚ₋₁₎₂ × 2ᴱ, with emin ≤ E ≤ emax,
each digit 0 or 1. The p digits form the significand and E is the exponent.[5]
Goldberg’s survey of the subject uses floating-point number to mean a real number that can be represented exactly in the format at hand,[8] and so does this lesson. The significand was long called the mantissa; the term significand, introduced by Forsythe and Moler in 1967, has generally replaced it.[6] Requiring normalization makes the representation unique, as Theorem 2 shows.[9]
In binary a normalized significand always begins with 1, so that 1 need not be stored. Formats that leave it out are said to have a hidden bit;[10] one name for the technique is “the hidden 1 technique”.[11] The stored bits after the point are the fraction.
In a binary format of precision p, the normalized numbers with exponent E are the 2ᵖ⁻¹ numbers 2ᴱ, 2ᴱ + 2ᴱ⁻ᵖ⁺¹, 2ᴱ + 2 × 2ᴱ⁻ᵖ⁺¹, …, up to 2ᴱ⁺¹ − 2ᴱ⁻ᵖ⁺¹: equally spaced, one step 2ᴱ⁻ᵖ⁺¹ apart. Each further exponent doubles the step.
The significands are 1.d₁…d₍ₚ₋₁₎₂: by Theorem 1 of lesson 2.4 they are N2ᵖ⁻¹ with N running through the 2ᵖ⁻¹ whole numbers from 2ᵖ⁻¹ to 2ᵖ − 1, one step 12ᵖ⁻¹ apart. Multiplying by 2ᴱ multiplies the step by 2ᴱ, giving 2ᴱ⁻ᵖ⁺¹, and raising E by 1 doubles it (Proposition 1).
The figure shows what fixed point cannot do. Near 0.25 the numbers are 1/32 apart, near 10 they are 1 apart, yet relative to the numbers themselves the steps are similar: for every normal number the step is more than 116 and at most 18 of the number. That is the point of floating point.
IEEE 754: binary32 and binary64
The formats of this section are those of the IEEE Standard for Floating-Point Arithmetic, IEEE 754. Its 1985 version called its two main formats single and double; its 2019 version names them binary32 and binary64.[12] The Java language’s float and double types are associated with them,[13] and the C standard’s float and double types match them.[14] Since at least 2000 almost all machines have used IEEE 754 binary floating-point arithmetic, and almost all platforms map the floats of the Python language to binary64;[15] the data formats of Intel’s processors correspond directly to formats of IEEE 754.[16]
binary32 uses 1 bit for the sign, 8 for the exponent and 23 for the significand, and with the hidden bit its precision is p = 24.[17] binary64 has an 11-bit exponent field and precision 53, so its fraction field has 52 bits; the Java specification lists the precisions 24 and 53, the exponent widths 8 and 11, and the exponent ranges −126 to 127 and −1022 to 1023.[18]
The exponent can be negative, but it is stored neither in sign and magnitude nor in two’s complement (lesson 2.2): IEEE 754 uses a biased representation, with the bias 127 in binary32 and 1023 in binary64.[19] The exponent field holds E + bias as an unsigned integer, so that it is never negative.[20]
Let a binary32 pattern have the sign bit s, the exponent field e (an 8-bit unsigned integer) and the fraction field f₁f₂…f₂₃. If 1 ≤ e ≤ 254, it holds the normal number
(−1)ˢ × 1.f₁f₂…f₂₃₂ × 2ᵉ⁻¹²⁷,
with E = e − 127 from −126 to 127. binary64 is the same with an 11-bit e from 1 to 2046, 52 fraction bits and e − 1023. The values e = 0 and e = 255 (2047 in binary64) are reserved for the special values of the next section.[21]
Which number does the binary32 pattern 0xC1460000 hold?
- In bits (lesson 1.4): 1100 0001 0100 0110 0000 … 0000. Split it: sign 1, exponent field 10000010, fraction 10001100000000000000000.
- The exponent field is 130, so E = 130 − 127 = 3. The significand is 1.100011₂, with the hidden 1 in front.
- −1.100011₂ × 2³ = −1100.011₂ = −(8 + 4 + 14 + 18).
Answer: −12.375, as in the figure.
Find the binary32 pattern of −0.40625.
- 0.40625 = 1332 = 0.01101₂ = 1.101₂ × 2⁻². The sign bit is 1.
- The exponent field is −2 + 127 = 125 = 01111101.
- The fraction field is the bits after the point, 101, followed by 20 zeros.
- The pattern is 1 01111101 10100000000000000000000 = 1011 1110 1101 0000 … 0000.
Answer: 0xBED00000. Check by decoding: sign −, E = 125 − 127 = −2, −1.101₂ × 2⁻² = −0.01101₂ = −0.40625.
Find the binary64 patterns of 1 and −2.5.
- 1 = 1.0₂ × 2⁰: sign 0, exponent field 0 + 1023 = 1023 = 011 1111 1111, fraction all 0. In hexadecimal: 0x3FF0000000000000.
- −2.5 = −10.1₂ = −1.01₂ × 2¹: sign 1, exponent field 1024 = 100 0000 0000, fraction 01 followed by 50 zeros.
- The first 12 bits are 1100 0000 0000 = 0xC00, and the next four, the start of the fraction, are 0100 = 4.
Answer: 0x3FF0000000000000 and 0xC004000000000000.
Someone decodes the binary32 pattern 0x3F800000 = 0 01111111 000…0 and gets 2¹²⁷. Someone else encodes 1.5 = 1.1₂ × 2⁰ with the fraction field 110…0. What went wrong?
- The exponent field 01111111 is 127, but E = 127 − 127 = 0: the bias must be subtracted. The pattern holds 1.0₂ × 2⁰ = 1.
- The leading 1 of 1.1₂ is not stored. The fraction field of 1.5 is 100…0, and its pattern is 0x3FC00000; the field 110…0 would give 1.11₂ = 1.75.
Answer: 0x3F800000 is 1, not 2¹²⁷; and 1.5 has the fraction field 100…0. Every pattern must be read with the bias and the hidden bit.
The bias has a useful consequence. With the exponent stored to the left of the fraction and biased to be nonnegative, the order of nonnegative numbers is the order of their patterns,[22] as the next proposition proves.
For two binary32 patterns with sign bit 0 and exponent fields below 255, the one with the larger value is the one that is larger when both are read as 32-bit unsigned integers (lesson 2.1).
If the exponent fields differ, by Proposition 2 of lesson 2.1 the pattern with the larger field is the larger unsigned integer, since the field lies to the left of the fraction. Its value is also larger: a normal number x with field e satisfies 2ᵉ⁻¹²⁷ ≤ x < 2ᵉ⁻¹²⁶, and every number with a smaller field, normal or subnormal, lies below 2ᵉ⁻¹²⁷. If the fields are equal, the values are (significand) × (the same power of 2), and the significands compare as the fraction fields do, which compare as unsigned integers.
Build a binary32 number
- Round
- 1
- Score
- 0
- Streak
- 0
Set the 32 bits of the binary32 pattern that holds −7.875.
A normal number is 1.f₂ × 2ᴱ with the exponent field E + 127; the leading 1 is not stored. Exponent field 0 means zero or a subnormal number 0.f₂ × 2⁻¹²⁶; 255 means infinity or NaN.
fraction field (23 bits)
- pattern
- 0x00000000
- sign
- 0: positive
- exponent
- 00000000 = 0 with fraction 0: zero
- class
- zero
- value
- +0
Floating-point arithmetic is much older than IEEE 754. George Stibitz of Bell Telephone Laboratories proposed it in the early 1940s, as an automatic scaling procedure, and it was built into the Bell Laboratories Model V relay computer;[23] the IEEE Computer Society’s biography of Stibitz calls Model 5 the first machine to implement floating-point arithmetic.[24] IEEE 754 fixes not only the formats but also the results: the basic operations give the same result in every bit on every machine that follows it.[25]
Zeros, subnormal numbers, infinities and NaN
The hidden bit has a price: no normal number is 0, because the significand always starts with 1. IEEE 754 therefore reserves the smallest and largest exponent fields for special values: ±0, denormalized numbers, ±∞ and NaNs.[26]
| Exponent field e | Fraction f | Value | Example |
|---|---|---|---|
| 0 | 0 | ±0 (the sign bit gives the sign) | 0x000000000x80000000 |
| 0 | not 0 | subnormal: ±0.f₂ × 2⁻¹²⁶ | 0x00000001 |
| 1 to 254 | any | normal: ±1.f₂ × 2ᵉ⁻¹²⁷ | 0x3F800000 |
| 255 | 0 | ±∞ | 0x7F8000000xFF800000 |
| 255 | not 0 | NaN | 0x7FC00000 |
- Zeros. The exponent field 0 with the fraction 0 is zero. The sign bit still counts, so there are two zeros, +0 and −0. They compare equal,[27] but some operations tell them apart: in Java, 1.0 / 0.0 is positive infinity and 1.0 / −0.0 negative infinity.[28]
- Subnormal numbers. The exponent field 0 with a nonzero fraction has no hidden 1: its value is 0.f₂ × 2⁻¹²⁶, with the exponent 1 − bias, not 0 − bias.[29] These numbers lie below the smallest normal number, 2⁻¹²⁶, so their magnitude cannot be written with a leading 1; they are called subnormal, and in the 1985 standard denormalized (denormal).[30]
[31] - Infinities. The exponent field of all 1s with the fraction 0 is ±∞.[32] An operation whose result is too large produces an infinity of the right sign,[33] and so does a nonzero number divided by 0: 1/0 = ∞ and −1/0 = −∞.[34]
- NaN. The exponent field of all 1s with a nonzero fraction is a NaN, Not a Number,[32] the result of an operation with no sensible value, such as 0/0.[34] A NaN is never equal to anything, not even to itself.[35]Every nonzero fraction, with either sign, is a NaN, so binary32 has 2 × (2²³ − 1) = 16,777,214 NaN patterns.
Subnormal numbers fill the gap between 0 and the smallest normal number with the step of the smallest exponent, so that results shrink toward 0 gradually; this behavior is called gradual underflow.[36] With it, x − y is 0 only when x = y.[37]
Which numbers do 0x00000001, 0x00800000 and 0x7F7FFFFF hold?
- 0x00000001: exponent field 0, fraction 00…01. Subnormal: 0.00…01₂ × 2⁻¹²⁶ with the 1 in place 23, so 2⁻²³ × 2⁻¹²⁶ = 2⁻¹⁴⁹ ≈ 1.401 × 10⁻⁴⁵, the smallest positive binary32 number.
- 0x00800000: exponent field 00000001 = 1, fraction 0. Normal: 1.0₂ × 2¹⁻¹²⁷ = 2⁻¹²⁶ ≈ 1.175 × 10⁻³⁸, the smallest positive normal number.
- 0x7F7FFFFF: exponent field 11111110 = 254, so E = 127, and every fraction bit 1: 1.11…1₂ × 2¹²⁷ = (2 − 2⁻²³) × 2¹²⁷ = 340,282,346,638,528,859,811,704,183,484,516,925,440.
Answer: 2⁻¹⁴⁹, 2⁻¹²⁶ and (2 − 2⁻²³) × 2¹²⁷ ≈ 3.403 × 10³⁸. The last is a whole number with 39 digits, exactly; above it lie only the patterns of the infinities and the NaNs.
In binary32, x = 1.1₂ × 2⁻¹²⁶ and y = 1.0₂ × 2⁻¹²⁶ are both normal. Is x − y = 2⁻¹²⁷ representable, and what would happen without subnormal numbers?
- x − y = 0.1₂ × 2⁻¹²⁶ = 2⁻¹²⁷, which is below 2⁻¹²⁶: not normal.
- It is the subnormal number 0.1000…0₂ × 2⁻¹²⁶, the pattern 0x00400000. So the difference is exact.
- A format without subnormal numbers would have to return 0, although x ≠ y.
Answer: 2⁻¹²⁷ is stored exactly, as a subnormal number; without subnormals the difference of two different numbers would be 0.
The toy format of section 2 uses the same rules in 7 bits: 1 sign bit, a 3-bit exponent field and a 3-bit fraction field, written here with spaces between the fields. What is its bias, and what do 0 011 100, 0 000 011, 0 110 111 and 0 111 000 hold?
- The fields 000 and 111 are reserved, so the normal fields are 1 to 6. For the exponents −2 to 3 of the figure, E = field − 3: the bias is 3. (It is chosen as IEEE 754 chooses 127 for 8 bits and 1023 for 11: half the largest field, rounded down.)
- 0 011 100: field 3, so E = 0; the significand is 1.100₂ = 1.5. The value is 1.5.
- 0 000 011: field 0 with a nonzero fraction, a subnormal number: 0.011₂ × 2¹⁻³ = 38 × 14 = 332.
- 0 110 111: field 6, so E = 3, and every fraction bit is 1: 1.111₂ × 2³ = 1111₂ = 15, the largest toy number.
- 0 111 000: the reserved field 111 with the fraction 0: +∞.
Answer: the bias is 3, and the patterns hold 1.5, 332, 15 and +∞. The smallest positive normal toy number is 1.000₂ × 2⁻² = 0.25 and the smallest subnormal one 0.001₂ × 2⁻² = 132, as the figure of section 2 shows.
Range and precision
| binary32 | binary64 | |
|---|---|---|
| Bits | 32 | 64 |
| Sign, exponent, fraction bits | 1, 8, 23 | 1, 11, 52 |
| Bias | 127 | 1023 |
| Exponents E of normal numbers | −126 to 127 | −1022 to 1023 |
| Precision p | 24 bits | 53 bits |
| Smallest positive (subnormal) | 2⁻¹⁴⁹ ≈ 1.401 × 10⁻⁴⁵ | 2⁻¹⁰⁷⁴ ≈ 4.941 × 10⁻³²⁴ |
| Smallest positive normal | 2⁻¹²⁶ ≈ 1.175 × 10⁻³⁸ | 2⁻¹⁰²² ≈ 2.225 × 10⁻³⁰⁸ |
| Largest finite | (2 − 2⁻²³) × 2¹²⁷ ≈ 3.403 × 10³⁸ | (2 − 2⁻⁵²) × 2¹⁰²³ ≈ 1.798 × 10³⁰⁸ |
Intel’s manual gives the same ranges and precisions: 24 bits and normal numbers from 2⁻¹²⁶ to about 2¹²⁸ for single precision, 53 bits and 2⁻¹⁰²² to about 2¹⁰²⁴ for double precision.[39]
How far apart are neighboring binary32 numbers near 1, near 1,000,000 and near 50,000,000?
- Near 1: 1 = 2⁰, so E = 0 and the step is 2⁻²³ ≈ 0.000000119.
- Near 1,000,000: 2¹⁹ = 524,288 ≤ 1,000,000 < 2²⁰, so E = 19 and the step is 2¹⁹⁻²³ = 2⁻⁴ = 0.0625.
- Near 50,000,000: 2²⁵ = 33,554,432 ≤ 50,000,000 < 2²⁶, so the step is 2²⁵⁻²³ = 4.
Answer: about 0.000000119, 0.0625 and 4. Relative to the numbers the steps are all near 10⁻⁷; absolutely they differ by a factor of more than thirty million.
Every whole number from −2²⁴ to 2²⁴ = 16,777,216 is a binary32 number, but 2²⁴ + 1 = 16,777,217 is not. In binary64 the same holds with 2⁵³.
A whole number 0 < n ≤ 2²⁴ has at most 24 significant bits, so its normalized significand needs at most 23 bits after the point, and its exponent is at most 24 ≤ 127. But 2²⁴ + 1 = 1.00…01₂ × 2²⁴, with the last 1 in place 24 after the point: it needs a 24-bit fraction. Equivalently, between 2²⁴ and 2²⁵ the step is 2²⁴⁻²³ = 2 (Theorem 3), so only even numbers are there. For binary64 replace 23 by 52.
For conversions to decimal, Goldberg proves that 9 significant decimal digits are enough to recover a binary32 number exactly,[41] and that binary64 needs 17.[42]
Why 0.1 cannot be stored exactly
Every finite binary32 or binary64 number is a significand with finitely many bits times a power of 2, so it has a finite binary numeral. By Theorem 2 of lesson 2.4, 0.1 = 110 has none, because 10 is not a power of 2. So no floating-point format of base 2 holds 0.1 exactly, whatever its precision.[43] The digits of 1/10 in binary can be found exactly as decimals are found by long division (Decimals: repeating decimals), with 2 in place of 10: double the remainder, write the whole tenths as the next digit, and keep the rest.
| Step | Remainder r (tenths) | 2r | Binary digit | New remainder |
|---|---|---|---|---|
| 1 | 1 | 2 | 0 | 2 |
| 2 | 2 | 4 | 0 | 4 |
| 3 | 4 | 8 | 0 | 8 |
| 4 | 8 | 16 | 1 | 6 |
| 5 | 6 | 12 | 1 | 2 |
| 6 | 2 | 4 | 0 | 4 |
| 7 | 4 | 8 | 0 | 8 |
| 8 | 8 | 16 | 1 | 6 |
1/10 = 0.0₂: the digit 0 followed by the block 0011 repeated forever.
Each step of the table finds the next binary digit of r/10: twice r/10 is the digit plus (new remainder)/10, so the digit is the whole part of 2r/10. Starting from r = 1, the remainders are 1, 2, 4, 8, 6 and then 2 again. From the second step on, the steps repeat in a cycle of four, so the digits from the second on repeat the block of steps 2–5, which is 0011. The Python documentation prints the same infinitely repeating fraction.[44]
Find the binary32 number nearest to 0.1, its pattern and its exact value.
- 0.1 = 0.000110011001100…₂ = 1.100110011001100…₂ × 2⁻⁴, moving the point 4 places right.
- Keep 24 significant bits: 1.10011001100110011001100, and the bits after them are 1100 1100…, more than half of the last place, so round up (lesson 2.4): 1.10011001100110011001101₂.
- Sign 0, exponent field −4 + 127 = 123 = 01111011, fraction 10011001100110011001101: the pattern is 0x3DCCCCCD.
- The value is 13,421,773 × 2⁻²⁷ = 0.100000001490116119384765625.
Answer: 0x3DCCCCCD, which holds 0.100000001490116119384765625, about 1.5 × 10⁻⁹ more than 0.1. Goldberg gives the same binary32 significand, 1.10011001100110011001101 × 2⁻⁴.[45]
What does binary64 store for 0.1?
- The same expansion is cut after 53 significant bits: 1.1001 1001 … 1001 1001₂ with the following bits 1001…, more than half the last place, so the last 1001 rounds up to 1010.
- The fraction in hexadecimal is 999999999999A and the exponent field −4 + 1023 = 1019 = 0x3FB, so the pattern is 0x3FB999999999999A.
Answer: 0x3FB999999999999A, whose exact value is 0.1000000000000000055511151231257827021181583404541015625, as the Python documentation also states.[46]
A program prints 0.1 for the stored number. Does that show that 0.1 is stored exactly?
- By Proposition 6 and Theorem 2 of lesson 2.4, no binary floating-point number equals 0.1.
- What is printed is a decimal approximation of the stored value: Python, for one, prints a rounded decimal approximation of the binary approximation stored by the machine.[47]
Answer: no. Printing rounds; the stored value is the binary64 number of the previous example.
Which of 0.5, 0.75, 0.2, 1,048,576.375 and 1/3 does binary64 store exactly?
- 0.5 = 1.0₂ × 2⁻¹ and 0.75 = 1.1₂ × 2⁻¹: exact.
- 0.2 = 15: 5 is not a power of 2, so not exact. 1/3: not exact either.
- 1,048,576.375 = 2²⁰ + 38 = 1.000…0011₂ × 2²⁰ with the last 1 in place 23 after the point: 24 significant bits, well within 53. Exact.
Answer: 0.5, 0.75 and 1,048,576.375 only. A number is stored exactly when it has a finite binary numeral whose significant bits fit the precision and whose exponent fits the range.
What the computer stores
Type a decimal number and see the binary32 pattern that stores it, its exact value and the error.
pattern 0x3DCCCCCD
0 01111011 10011001100110011001101
stored value 1.10011001100110011001101₂ × 2⁻⁴
= 0.100000001490116119384765625
error (stored − x) 0.000000001490116119384765625
relative to x: about 1.49 × 10⁻⁸
Every arithmetic operation on floating-point numbers ends with a rounding like the one of 0.1. How large those errors are, and why 0.1 + 0.2 is not 0.3 in binary64, is the next lesson, “Rounding error in floating point”. The 16-bit formats used to train and run neural networks, half precision and bfloat16, are the lesson after it.
Exercises
Write (a) 40, (b) 0.3125 and (c) 1 in normalized binary form. Why do (a) and (b) have the same significand?
▸ Show solution
(a) 40 = 101000₂ = 1.01₂ × 2⁵. (b) 0.3125 = 516 = 0.0101₂ = 1.01₂ × 2⁻². (c) 1 = 1.0₂ × 2⁰.
40 and 0.3125 have the same significand: 40 = 0.3125 × 128 = 0.3125 × 2⁷, and multiplying by a power of 2 only changes E.
Decode the binary32 patterns 0x41200000 and 0xBF000000.
▸ Show solution
0x41200000 = 0100 0001 0010 0000 …: sign 0, exponent field 10000010 = 130, E = 3, fraction 0100…: 1.01₂ × 2³ = 1010₂ = 10.
0xBF000000 = 1011 1111 0000 …: sign 1, exponent field 01111110 = 126, E = −1, fraction 0: −1.0₂ × 2⁻¹ = −0.5.
Encode 100.5 as a binary32 pattern.
▸ Show solution
100.5 = 1100100.1₂ = 1.1001001₂ × 2⁶. Sign 0, exponent field 6 + 127 = 133 = 10000101, fraction 1001001 followed by 16 zeros.
Pattern: 0 10000101 10010010000000000000000 = 0100 0010 1100 1001 0000 … = 0x42C90000.
What do the binary32 patterns (a) 0x80000000, (b) 0x7F800000, (c) 0xFFC00000 and (d) 0x00400000 hold?
▸ Show solution
(a) Exponent field 0, fraction 0, sign 1: −0. (b) Exponent field 11111111, fraction 0: +∞. (c) Exponent field 11111111 and fraction 100…0, not 0: a NaN. (d) Exponent field 0, fraction 100…0: the subnormal 0.1₂ × 2⁻¹²⁶ = 2⁻¹²⁷.
Find the smallest positive normal, the smallest positive subnormal and the largest finite binary64 numbers as powers of 2.
▸ Show solution
Normal binary64 numbers have E from −1022 to 1023. The smallest normal number is 1.0₂ × 2⁻¹⁰²² = 2⁻¹⁰²²; the smallest subnormal is 0.00…01₂ × 2⁻¹⁰²² with the 1 in place 52, so 2⁻⁵² × 2⁻¹⁰²² = 2⁻¹⁰⁷⁴; the largest finite number is (2 − 2⁻⁵²) × 2¹⁰²³.
Which binary32 numbers are nearest to 16,777,219 and to 16,777,221?
▸ Show solution
2²⁴ = 16,777,216 ≤ 16,777,219 < 2²⁵, so the step there is 2 and the neighbors are 16,777,218 and 16,777,220. 16,777,219 lies exactly halfway, so “nearest” does not decide; the rule for this case, ties to even, is in the next lesson (it gives 16,777,220).
16,777,221 lies between 16,777,220 and 16,777,222, also halfway; ties to even gives 16,777,220.
Find the binary digits of 1/5 by doubling remainders. How are they related to those of 1/10, and what is the binary32 pattern of 0.2?
▸ Show solution
By the method of the table, with remainders out of 5: r = 1 → 2r = 2, digit 0; 2 → 4, digit 0; 4 → 8, digit 1, remainder 3; 3 → 6, digit 1, remainder 1; and then the remainder 1 returns. So 15 = 0.₂.
Then 1/10 = (1/5) ÷ 2, and halving moves the binary point one place left: 0.0₂, as Proposition 6 found. 0.2 = 1.1001 1001…₂ × 2⁻³ has the same significand as 0.1, with the exponent one larger, so binary32 stores it as 0x3E4CCCCD.
How many binary32 patterns hold finite numbers? Check your count against the infinities and NaNs.
▸ Show solution
The binary32 numbers with exponent E are 2²³ in number (Theorem 3 with p = 24), and the normal exponents run from −126 to 127, 254 of them. So there are 254 × 2²³ = 2,130,706,432 positive normal numbers, and as many negative ones.
With the 2²³ − 1 positive and 2²³ − 1 negative subnormal numbers and the two zeros: 2 × 2,130,706,432 + 2 × 8,388,607 + 2 = 4,278,190,080 finite patterns. The remaining 2³² − 4,278,190,080 = 16,777,216 patterns are the two infinities and the 16,777,214 NaNs.
Summary
- Every positive number is s × 2ᴱ in exactly one way with 1 ≤ s < 2: its normalized form. 2⁻ᵏ means 1/2ᵏ, and multiplying by 2ᴱ moves the binary point E places.
- A floating-point format of precision p stores a sign, an exponent E in a fixed range and a p-bit significand 1.f; the leading 1 is the hidden bit. Between 2ᴱ and 2ᴱ⁺¹ its numbers are 2ᴱ⁻ᵖ⁺¹ apart, so the step grows with the numbers and stays about the same relative to them.
- IEEE 754 binary32 has 1 sign bit, 8 exponent bits with bias 127 and 23 fraction bits (p = 24); binary64 has 1, 11 with bias 1023, and 52 (p = 53). A normal number is (−1)ˢ × 1.f₂ × 2ᵉ⁻ᵇⁱᵃˢ.
- The exponent field 0 holds ±0 and the subnormal numbers 0.f₂ × 2¹⁻ᵇⁱᵃˢ; the field of all 1s holds ±∞ and the NaNs. binary32 reaches about 3.4 × 10³⁸ with about 7 decimal digits, binary64 about 1.8 × 10³⁰⁸ with about 16.
- 0.1 = 0.0 0011 0011…₂ repeats forever, so no binary format stores it exactly: binary32 holds 0.100000001490116119384765625 and binary64 0.1000000000000000055511151231257827021181583404541015625.
Sources
- 1.Lynn Marecek, MaryAnne Anthony-Smith and Andrea Honeycutt Mathis, Elementary Algebra (2nd ed., OpenStax, Rice University, 2020).Chapter 6, “Polynomials”, section 6.7, “Integer Exponents and Scientific Notation” (“Use the Definition of a Negative Exponent”), p. 777 (the whole topic: pp. 776–777).
“If n is an integer and a ≠ 0, then a⁻ⁿ = 1/aⁿ.”
Used for: the definition of a power with a negative exponent: 2⁻ᵏ = 1/2ᵏ. - 2.Lynn Marecek, MaryAnne Anthony-Smith and Andrea Honeycutt Mathis, Elementary Algebra (2nd ed., OpenStax, Rice University, 2020).Chapter 6, “Polynomials”, section 6.7, “Integer Exponents and Scientific Notation” (“Convert from Decimal Notation to Scientific Notation”), p. 787 (the whole topic: pp. 787–789).
“A number is expressed in scientific notation when it is of the form a × 10ⁿ where 1 ≤ a < 10 and n is an integer”
Used for: the definition of scientific notation: a × 10ⁿ with 1 ≤ a < 10 and n an integer. - 3.Werner Buchholz (ed.), Planning a Computer System: Project Stretch (McGraw-Hill Book Company, New York, 1962).Chapter 8, “Floating-point Operation” (by S. G. Campbell), section 8.2, “Floating-point Arithmetic”, p. 95 (the whole topic: pp. 94–95).
“The exponent is variable and determines the true position of the decimal or binary point of the number; whence the name floating point.”
Used for: each number’s own exponent fixes where its point really is; hence the name floating point. - 4.Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).Section “4.8.2, “Floating-Point Format””. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
“In this format, a real number has three parts: a sign, a significand, and an exponent (see Figure 4-11). The sign is a binary value that indicates whether the number is positive (0) or negative (1).”
Used for: in a floating-point format a number has three parts, a sign, a significand and an exponent; the sign bit is 0 for positive and 1 for negative. - 5.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Rounding Error”: “Floating-point Formats”, p. 175 (the whole topic: pp. 175–176). doi.org/10.1145/103162.103163 · read it online.
“Floating-point representations have a base β (which is always assumed to be even) and a precision p.”
Used for: a floating-point format has a base (here 2) and a precision p. - 6.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Rounding Error”: “Floating-point Formats” (and footnote 1), p. 176 (the whole topic: pp. 175–176). doi.org/10.1145/103162.103163 · read it online.
“where d.dd… d is called the significand”
Used for: the digits d₀.d₁…d₍ₚ₋₁₎ are the significand and the power the exponent (the sentence begins “In general, a floating-point number will be represented as ± d.dd… d × βᵉ”); its footnote says the term significand was introduced by Forsythe and Moler (1967) and has generally replaced the older term mantissa. - 7.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Rounding Error”: “Floating-point Formats”, p. 176 (the whole topic: pp. 175–176). doi.org/10.1145/103162.103163 · read it online.
“If the leading digit is nonzero (d0 ≠ 0 in equation (1) above), then the representation is said to be normalized.”
Used for: a significand is normalized when its leading digit is not 0. - 8.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Rounding Error”: “Floating-point Formats”, p. 176 (the whole topic: pp. 175–176). doi.org/10.1145/103162.103163 · read it online.
“The term floating-point number will be used to mean a real number that can be exactly represented in the format under discussion.”
Used for: Goldberg uses “floating-point number” for a real number that the format represents exactly. - 9.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Rounding Error”: “Floating-point Formats”, p. 176 (the whole topic: pp. 175–176). doi.org/10.1145/103162.103163 · read it online.
“Requiring that a floating-point representation be normalized makes the representation unique.”
Used for: requiring normalization makes the representation unique. - 10.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The IEEE Standard”: “Formats and Operations” (“Base”), p. 190 (the whole topic: pp. 189–190). doi.org/10.1145/103162.103163 · read it online.
“Since floating-point numbers are always normalized, the most significant bit of the significand is always 1, and there is no reason to waste a bit of storage representing it. Formats that use this trick are said to have a hidden bit.”
Used for: a normalized binary significand always begins with 1, which need not be stored; formats that leave it out have a hidden bit. - 11.Jean-Claude Franchitti and others, Introduction to Computer Science (web PDF of April 20, 2026, OpenStax, Rice University, 2024).Chapter 5, “Hardware Realizations of Algorithms: Computer Systems Design”, section 5.3, “Machine-Level Information Representation” (“Real Numbers (Floating Points)”), p. 209 (the whole topic: pp. 208–210).
“Note we don’t need to store the “1.” because we know that it exists except for some special cases. And this is why one of the names of the floating point format is “the hidden 1 technique.””
Used for: the leading 1 is not stored; one name for the technique is “the hidden 1 technique”. - 12.James Gosling and others, “The Java Language Specification, Java SE 25 Edition, Chapter 4: Types, Values, and Variables”, Oracle (2025).Section “4.2.3, “Floating-Point Types and Values””. docs.oracle.com/javase/specs/jls/se25/html/jls-4.html · open at the quoted passage.
“In Java SE 15 and later, the Java programming language uses the 2019 version of the IEEE 754 Standard. Prior to Java SE 15, the Java programming language used the 1985 version of the IEEE 754 Standard, where the binary32 format was known as the single format and the binary64 format was known as the double format.”
Used for: the 1985 version of IEEE 754 called binary32 and binary64 the single and double formats; the 2019 version names them binary32 and binary64. - 13.James Gosling and others, “The Java Language Specification, Java SE 25 Edition, Chapter 4: Types, Values, and Variables”, Oracle (2025).Section “4.2.3, “Floating-Point Types and Values””. docs.oracle.com/javase/specs/jls/se25/html/jls-4.html · open at the quoted passage.
“The floating-point types are float and double, which are conceptually associated with the 32-bit binary32 and 64-bit binary64 floating-point formats for IEEE 754 values and operations”
Used for: Java’s float and double types are associated with binary32 and binary64. - 14.ISO/IEC JTC 1/SC 22/WG 14, “N3220: working draft of ISO/IEC 9899:2024 (C23), the C programming language standard. A free draft that the C committee lists as similar to the published standard, not the ISO text itself”, open-std.org, the site of the ISO C standards committee (22 February 2024).Section “Annex F, F.2.1, “General” (in F.2, “Types”), paragraph 1 (p. 511)”. open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf · open at the quoted passage.
“The float type matches the ISO/IEC 60559 binary32 format. — The double type matches the ISO/IEC 60559 binary64 format.”
Used for: C’s float and double types match binary32 and binary64 (ISO/IEC 60559 is IEEE 754: Annex F.1, on the same page, calls it “also designated as IEEE Standard for Floating-Point Arithmetic (IEEE 754–2019)”). - 15.“15. Floating-Point Arithmetic: Issues and Limitations”, The Python Tutorial, Python 3 documentation, Python Software Foundation.Section “15.1, “Representation Error””. docs.python.org/3/tutorial/floatingpoint.html · open at the quoted passage.
“Since at least 2000, almost all machines use IEEE 754 binary floating-point arithmetic, and almost all platforms map Python floats to IEEE 754 binary64 “double precision” values.”
Used for: since at least 2000 almost all machines use IEEE 754 binary floating-point arithmetic, and almost all platforms map Python’s floats to binary64. - 16.Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).Section “4.2.2, “Floating-Point Data Types””. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
“The data formats for these data types correspond directly to formats specified in the IEEE Standard 754 for Floating-Point Arithmetic.”
Used for: the floating-point data formats of Intel’s processors correspond directly to formats of IEEE 754. - 17.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The IEEE Standard”: “Formats and Operations” (“Base”), p. 190 (the whole topic: pp. 189–191). doi.org/10.1145/103162.103163 · read it online.
“IEEE 754 single precision is encoded in 32 bits using 1 bit for the sign, 8 bits for the exponent, and 23 bits for the significand. However, it uses a hidden bit, so the significand is 24 bits (p = 24), even though it is encoded using only 23 bits.”
Used for: binary32 uses 1 sign bit, 8 exponent bits and 23 stored significand bits; with the hidden bit its precision is 24. - 18.James Gosling and others, “The Java Language Specification, Java SE 25 Edition, Chapter 4: Types, Values, and Variables”, Oracle (2025).Section “4.2.3, “Floating-Point Types and Values” (Table 4.2.3-A, “Floating-point parameters”)”. docs.oracle.com/javase/specs/jls/se25/html/jls-4.html · open at the quoted passage.
“N 24 53 K 8 11 Emax +127 +1023 Emin -126 -1022”
Used for: the parameters of float (binary32) and double (binary64): precision N = 24 and 53, exponent width K = 8 and 11, exponents from −126 to 127 and from −1022 to 1023. - 19.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The IEEE Standard”: “Formats and Operations” (“Exponent”), p. 192 (the whole topic: pp. 192). doi.org/10.1145/103162.103163 · read it online.
“The IEEE binary standard does not use either of these methods to represent the exponent, but instead uses a biased representation. In the case of single precision, where the exponent is stored in 8 bits, the bias is 127 (for double precision it is 1023).”
Used for: the exponent is stored neither in sign and magnitude nor in two’s complement but biased, with the bias 127 in binary32 and 1023 in binary64. - 20.Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).Section “4.8.2.2, “Biased Exponent””. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
“This means that a constant is added to the actual exponent so that the biased exponent is always a positive number.”
Used for: the exponent field holds the exponent plus the bias, so that it is never negative. - 21.Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).Section “4.8.3.2, “Normalized and Denormalized Finite Numbers””. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
“The normalized finite numbers comprise all the non-zero finite values that can be encoded in a normalized real number format between zero and ∞.”
Used for: the normal numbers are the nonzero finite values with a normalized significand (in single precision, the text goes on, those with biased exponents from 1 to 254, unbiased −126 to 127); the other exponent fields are reserved. - 22.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Rounding Error”: “Floating-point Formats”, p. 176 (the whole topic: pp. 176). doi.org/10.1145/103162.103163 · read it online.
“since this preserves the fact that the numerical ordering of nonnegative real numbers corresponds to the lexicographic ordering of their floating-point representations.”
Used for: with the exponent stored to the left and biased, the order of nonnegative numbers is the order of their patterns (Goldberg’s footnote 2 adds: “This assumes the usual arrangement where the exponent is stored to the left of the significand”). - 23.Werner Buchholz (ed.), Planning a Computer System: Project Stretch (McGraw-Hill Book Company, New York, 1962).Chapter 8, “Floating-point Operation” (by S. G. Campbell), section 8.2, “Floating-point Arithmetic”, p. 94 (the whole topic: pp. 94–95).
“G. R. Stibitz in the early 1940’s proposed an automatic scaling procedure, called floating-point arithmetic, which was incorporated in the Bell Telephone Laboratories’ Model V Relay Computer.”
Used for: Stibitz proposed floating-point arithmetic, an automatic scaling procedure, in the early 1940s, and it was built into the Bell Laboratories Model V relay computer. - 24.J. A. N. Lee, “George Robert Stibitz”, Computer Pioneers, IEEE Computer Society History Committee.
“Model 5 was the first to implement floating-point arithmetic.”
Used for: the IEEE Computer Society’s biography calls Model 5 the first machine to implement floating-point arithmetic (a second, independent source for the Model V). - 25.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Rounding Error”, p. 175 (the whole topic: pp. 175). doi.org/10.1145/103162.103163 · read it online.
“Thus, when a program is moved from one machine to another, the results of the basic operations will be the same in every bit if both machines support the IEEE standard.”
Used for: under IEEE 754 the basic operations give the same result in every bit on every machine that follows the standard. - 26.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The IEEE Standard”: “Special Quantities”, p. 195 (the whole topic: pp. 194–195). doi.org/10.1145/103162.103163 · read it online.
“The IEEE standard specifies the following special values (see TABLE D-2): ± 0, denormalized numbers, ±∞ and NaNs”
Used for: IEEE 754 reserves the smallest and largest exponent fields for special values: ±0, denormalized numbers, ±∞ and NaNs. - 27.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The IEEE Standard”: “Special Quantities” (“Signed Zero”), p. 198 (the whole topic: pp. 198–199). doi.org/10.1145/103162.103163 · read it online.
“Thus the IEEE standard defines comparison so that +0 = -0, rather than -0 < +0.”
Used for: +0 and −0 compare equal. - 28.James Gosling and others, “The Java Language Specification, Java SE 25 Edition, Chapter 4: Types, Values, and Variables”, Oracle (2025).Section “4.2.3, “Floating-Point Types and Values””. docs.oracle.com/javase/specs/jls/se25/html/jls-4.html · open at the quoted passage.
“Other operations can distinguish positive and negative zero; for example, 1.0/0.0 has the value positive infinity, while the value of 1.0/-0.0 is negative infinity.”
Used for: some operations tell +0 and −0 apart: in Java 1.0/0.0 is positive infinity and 1.0/−0.0 negative infinity. - 29.Jean-Claude Franchitti and others, Introduction to Computer Science (web PDF of April 20, 2026, OpenStax, Rice University, 2024).Chapter 5, “Hardware Realizations of Algorithms: Computer Systems Design”, section 5.3, “Machine-Level Information Representation” (“Real Numbers (Floating Points)”), p. 210 (the whole topic: pp. 208–210).
“If the exponent is 0 (i.e., 00000000) we are in denormalized encoding (also called subnormal).”
Used for: the exponent field 0 (with a nonzero fraction) is the denormalized or subnormal encoding: no hidden 1, the fraction is 0.xxxx, and the exponent is 1 − bias instead of 0 − bias (the text’s next lines). - 30.James Gosling and others, “The Java Language Specification, Java SE 25 Edition, Chapter 4: Types, Values, and Variables”, Oracle (2025).Section “4.2.3, “Floating-Point Types and Values””. docs.oracle.com/javase/specs/jls/se25/html/jls-4.html · open at the quoted passage.
“then the value is said to be a subnormal value, because its magnitude is below the magnitude of the smallest normalized value.”
Used for: these numbers are called subnormal because their magnitude is below that of the smallest normal number. - 31.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The IEEE Standard”: “Special Quantities” (“Denormalized Numbers”, footnote 1), p. 199 (the whole topic: pp. 199–200). doi.org/10.1145/103162.103163 · read it online.
“They are called subnormal in 854, denormal in 754.”
Used for: the 1985 standard, IEEE 754, called them denormal (denormalized). - 32.Jean-Claude Franchitti and others, Introduction to Computer Science (web PDF of April 20, 2026, OpenStax, Rice University, 2024).Chapter 5, “Hardware Realizations of Algorithms: Computer Systems Design”, section 5.3, “Machine-Level Information Representation” (“Real Numbers (Floating Points)”), p. 210 (the whole topic: pp. 208–210).
“If the exponent is all 1s and the fraction is all 0s, it represents infinity. If the exponent is all 1s and the fraction is non-zero, this is called NaN (Not a Number)”
Used for: the exponent field of all 1s with the fraction 0 is infinity, and with a nonzero fraction NaN, Not a Number. - 33.James Gosling and others, “The Java Language Specification, Java SE 25 Edition, Chapter 15: Expressions”, Oracle (2025).Section “15.4, “Floating-point Expressions””. docs.oracle.com/javase/specs/jls/se25/html/jls-15.html · open at the quoted passage.
“A floating-point operation that overflows produces a signed infinity.”
Used for: an operation whose result is too large produces an infinity of the right sign. - 34.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The IEEE Standard”: “Special Quantities” (“Infinity”), p. 197 (the whole topic: pp. 196–197). doi.org/10.1145/103162.103163 · read it online.
“The division of 0 by 0 results in a NaN. A nonzero number divided by 0, however, returns infinity: 1/0 = ∞, -1/0 = -∞.”
Used for: 0/0 gives a NaN; a nonzero number divided by 0 gives infinity: 1/0 = ∞, −1/0 = −∞. - 35.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Systems Aspects”: “Languages and Compilers” (“The IEEE Standard”), p. 212 (the whole topic: pp. 211–212). doi.org/10.1145/103162.103163 · read it online.
“a NaN is never equal to any other number (including another NaN), so x = x is no longer always true. In fact, the expression x ≠ x is the simplest way to test for a NaN”
Used for: a NaN is never equal to anything, not even itself; “x ≠ x” is true exactly for a NaN. - 36.Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).Section “4.8.3.2, “Normalized and Denormalized Finite Numbers””. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
“A denormalized number is computed through a technique called gradual underflow.”
Used for: subnormal (denormalized) numbers give gradual underflow. - 37.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The IEEE Standard”: “Special Quantities” (“Denormalized Numbers”), p. 200 (the whole topic: pp. 199–200). doi.org/10.1145/103162.103163 · read it online.
“It is easy to verify that (10) always holds when using gradual underflow.”
Used for: with gradual underflow, x − y = 0 only when x = y (Goldberg’s property (10), x = y ⇔ x − y = 0). - 38.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The IEEE Standard”: “Special Quantities” (“NaNs”), p. 196 (the whole topic: pp. 195–196). doi.org/10.1145/103162.103163 · read it online.
“In general, whenever a NaN participates in a floating-point operation, the result is another NaN.”
Used for: computation continues with a NaN, and any operation with a NaN operand produces a NaN. - 39.Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).Section “4.2.2, “Floating-Point Data Types” (Table 4-2, “Length, Precision, and Range of Floating-Point Data Types”)”. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
“Single Precision 32 24 2⁻¹²⁶ to 2¹²⁸ 1.18 × 10⁻³⁸ to 3.40 × 10³⁸”
Used for: single precision: 32 bits, precision 24, approximate normal range 2⁻¹²⁶ to 2¹²⁸, 1.18 × 10⁻³⁸ to 3.40 × 10³⁸. - 40.Intel Corporation, “Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (order number 253665-084US)”, Intel (June 2024).Section “4.2.2, “Floating-Point Data Types” (Table 4-2, “Length, Precision, and Range of Floating-Point Data Types”)”. cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf · open at the quoted passage.
“Double Precision 64 53 2⁻¹⁰²² to 2¹⁰²⁴ 2.23 × 10⁻³⁰⁸ to 1.80 × 10³⁰⁸”
Used for: double precision: 64 bits, precision 53, approximate normal range 2⁻¹⁰²² to 2¹⁰²⁴, 2.23 × 10⁻³⁰⁸ to 1.80 × 10³⁰⁸. - 41.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The Details”: “Binary to Decimal Conversion” (Theorem 15), p. 227 (the whole topic: pp. 227–228). doi.org/10.1145/103162.103163 · read it online.
“However, if nine decimal digits are used, then converting the decimal number to the closest binary number will recover the original floating-point number.”
Used for: 9 significant decimal digits are enough to recover a binary32 number exactly. - 42.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “The Details”: “Binary to Decimal Conversion”, p. 228 (the whole topic: pp. 227–228). doi.org/10.1145/103162.103163 · read it online.
“The same argument applied to double precision shows that 17 decimal digits are required to recover a double precision number.”
Used for: binary64 needs 17 decimal digits. - 43.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Rounding Error”: “Floating-point Formats”, p. 176 (the whole topic: pp. 175–176). doi.org/10.1145/103162.103163 · read it online.
“Although it has a finite decimal representation, in binary it has an infinite repeating representation. Thus when β = 2, the number 0.1 lies strictly between two floating-point numbers and is exactly representable by neither of them.”
Used for: 0.1 has an infinite repeating binary representation, so no binary floating-point format holds it exactly. - 44.“15. Floating-Point Arithmetic: Issues and Limitations”, The Python Tutorial, Python 3 documentation, Python Software Foundation.
“In base 2, 1/10 is the infinitely repeating fraction”
Used for: in base 2, 1/10 is the infinitely repeating fraction 0.0001100110011… (the page prints the digits on the next line). - 45.David Goldberg, “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1) (1991), pp. 5–48; cited from its edited reprint in Sun Microsystems’ Numerical Computation Guide (May 2000), Appendix D, pp. 173–252.Section “Rounding Error”: “Floating-point Formats”, p. 175 (the whole topic: pp. 175–176). doi.org/10.1145/103162.103163 · read it online.
“If β = 2 and p = 24, then the decimal number 0.1 cannot be represented exactly, but is approximately 1.10011001100110011001101 × 2⁻⁴.”
Used for: in binary32 (p = 24) 0.1 is stored as 1.10011001100110011001101 × 2⁻⁴. - 46.“15. Floating-Point Arithmetic: Issues and Limitations”, The Python Tutorial, Python 3 documentation, Python Software Foundation.Section “15.1, “Representation Error””. docs.python.org/3/tutorial/floatingpoint.html · open at the quoted passage.
“meaning that the exact number stored in the computer is equal to the decimal value 0.1000000000000000055511151231257827021181583404541015625.”
Used for: binary64 stores 0.1 as exactly 0.1000000000000000055511151231257827021181583404541015625. - 47.“15. Floating-Point Arithmetic: Issues and Limitations”, The Python Tutorial, Python 3 documentation, Python Software Foundation.
“Python only prints a decimal approximation to the true decimal value of the binary approximation stored by the machine.”
Used for: Python prints a decimal approximation of the binary value stored for 0.1, not the stored value.