IEEE 754-2019 audit and study plan
Start with small C experiments on Linux x86-64. Use worked examples and reference software for parts of the standard the lab target lacks.
IEEE 754-2019 official page · IEEE Xplore publication · Free preview with contents
Audit of the material available now
- Lesson 1. The normal binary32 field widths, bias, implied bit, decoding formula, and worked encodings agree with §§2.1, 3.3, 3.4, and 3.6. The lesson now calls out when rounding is needed (§4.3) and distinguishes the full significand from the stored fraction field.
- Format reference. Checked the binary32 and binary64 formulas, exponent ranges, and the binary32 landmark words against §§3.3, 3.4, and 3.6. The quiet-NaN example uses the convention described in §6.2.1 and used by x86.
- C and x86 lab. IEEE specifies the interchange encoding and character conversion
rules (§§3.4, 5.12). The x86 manual supplies the memory byte order. The C specification and lab probe
supply the evidence for
memcpy, argument types, and the observedprintfspelling.
IEEE 754-2019 · Intel Volume 1, Chapter 4 · C11 draft, §§6.2.6.1 and 7.21.6.1
Representation and rounding
Lesson 1 is available. Lessons 2 through 23 are proposed. Each entry ends with an exercise.
- Inside a C float. Encode a normal binary32 value by hand, then recover its sign, stored exponent, and fraction field in C.
- The binary number line. Signed zero, subnormals, infinities, quiet and signaling NaNs. Build a classifier for all ten signed or NaN classes in §5.7.2. Calculate the gap between the largest subnormal and the smallest normal in binary32 and binary64.
- What a format promises. Scope and conformance, arithmetic versus interchange formats,
and the distinction between numerical data, their representations, and their encodings. Use §3.6 to
derive binary16 and binary128 parameters, then compare them with the extended and extendable rules
in §3.7. Look up the 1985, 2008, and 2019 conformance predicates. Explain why a C
long doubleneeds a platform specification. - Spacing and rounding directions. Use spacing in units in the last place (ULPs) to round positive and negative halfway cases by hand. Compare the five directions and the binary default. Ties-away is required for decimal arithmetic and optional as a selectable rounding direction for binary arithmetic. Find which two binary32 values bracket the exact value 1/10.
Arithmetic, conversions, and text
- How addition works. Align significands, add or subtract, normalize, then round. Work through a toy format using guard, round, and sticky bits, which summarize the digits the answer cannot store. Include cancellation and a carry into the exponent.
- Multiply, divide, square root, and fused multiply-add. Trace the intermediate
result and the destination rounding. Find inputs for which one fused operation and separate multiply
and add produce different results. Compare the destination-specific
formatOfrules. - Neighbors, scaling, and remainder. Predict
nextUp(-0), the sign of an exact zero remainder, andremainder(7, 2). Compare the floating and integer result forms oflogB(0), then usescaleBto shift a binary value through the subnormal range. - Conversions and integral rounding. Narrow and widen formats, convert between radices and between floats and integers, and round to an integral value while keeping a floating result. Compare the inexact-reporting variants with their quieter counterparts, including range failures and signed and unsigned destinations.
- Decimal and hexadecimal text. Follow §5.12 through parsing, formatting, rounding, and round-trip digit guarantees. Round-trip a binary32 value through hex and decimal. Check the permitted spellings of special values and the rules at H, the number of significant decimal digits an implementation supports for correctly rounded binary conversions.
Special values, comparisons, and exceptions
- Signs, infinities, and NaN propagation. Predict signs for products, zero sums and quotients. Trace the difference between copying or changing a sign bit and doing arithmetic on a signaling NaN. Record when the standard leaves NaN sign or payload selection open.
- Comparison and total ordering. Fill out the quiet and signaling predicate tables
for equality, inequality, and unordered operands. Order signed zeros and quiet and signaling NaNs
with
totalOrderandtotalOrderMag. Identify which NaN ordering IEEE leaves to the implementation and why total order is different from ordering every raw encoding. - The five exceptions and sticky flags. Predict the result and flags for invalid, divide-by-zero, overflow, underflow, and inexact. Compare exact and inexact tiny results. Work a vector on which before- and after-rounding tininess detection differs. Exercise saving, testing, raising, clearing, and restoring subsets of flags.
- Alternate handling. Model default handling, suppression and recording of flags,
result substitution, substitution with the product or quotient sign via
substituteXor, andabruptUnderflow. Trace one block under resuming, immediate, and delayed handlers, including transfers that do not return. Compare abrupt underflow with x86 flush-to-zero and input denormals-are-zero. Determine which handlers run for an exact tiny result under §8.3.
Decimal formats
- Decimal storage. Read decimal32, decimal64, and decimal128 through the combination field. Decode a three-digit group stored in ten bits with densely packed decimal (DPD), then compare binary integer decimal (BID), which encodes the coefficient as an integer. Look up how canonical and noncanonical encodings are treated and trace the re-encoding operations in §5.5.2.
- Decimal cohorts and quantum. A cohort groups representations of the same numeric
value. Quantum records the place value of the last significand digit. Predict the preferred exponent
of
1.20 + 3.4, compare1.0and1.00withsameQuantum, and choose operands that makequantizeraise invalid.
Recommended operations
Clause 9 recommends additional operations and allows languages and implementations to define conforming extensions under §9.1. Use operation tables and reference models where a C library lacks a corresponding operation.
- Additional mathematical functions. Use Table 9.1 to classify the exponential,
logarithmic, trigonometric, hyperbolic, power, root, and other functions. Build a special-case
matrix for
sinPi,pow, andpowr. Find one input that distinguishesrootnfrom square root. Check the correct-rounding and exception rules before assessing a math library's claim of conformance. - Dynamic modes. Distinguish a statically scoped attribute from a mode a program can change at run time. Save, restore, and reset modes in a lab. Trace a program with separate binary and decimal rounding directions and identify which precedence and scope rules the language must supply.
- Reductions and augmented arithmetic. Vary the order of a sum or dot product and
examine
scaledProdandscaledProdSum, which return a product and scale factor. Then compute an augmented sum, difference, and product, each of which returns a rounded result and its residual. Work a halfway case under the special ties-toward-zero rule in §9.5. - Minimums, maximums, and NaN payloads. Make a result-and-flag table for the
propagating, number-preferring, and magnitude forms with zeros and both NaN types. Study how 2019
replaced
minNumandmaxNum. TrygetPayload,setPayload, andsetPayloadSignalingwith an inadmissible payload.
C expression evaluation and verification
- Where C rounds. Track widths through assignment, arguments, and return values.
Single-step an x87 build and a scalar SSE or AVX build where supported. Use a double-rounding
example to examine
preferredWidthand compare contraction, reassociation, and wider intermediates with the literal evaluation rules. - Reproducible numerical results. Freeze a sequence of operations, formats, and attributes and compare results and flags across two builds. State which flags §11 treats as reproducible and which NaN and decimal properties a reproducible program must avoid depending on. Use an Annex A reference to motivate a test of order-dependent sums.
- Debugging floating-point programs. Use Annex B's scenarios to isolate the first exception and trace a NaN's origin. Use Annex C to find the rule for an unfamiliar operation and turn it into a regression vector.
- Capstone. Implement a binary32 adder in C with integer operations. Compare its bits and exception flags with Berkeley SoftFloat and use TestFloat-generated cases. Include exact cancellation, halfway ties, subnormals, and invalid operations.
Clause index
| IEEE 754-2019 | Lesson numbers and coverage |
|---|---|
| §§1–2 | 1, 3. Terms, scope, and language versus implementation conformance. |
| §3 | 1–3, 14–15. Binary and decimal representations, format parameters, and extended formats. |
| §4 | 4, 17. Rounding, scoped attributes, and runtime modes. |
| §§5.1–5.4 | 5–9, 14–15. Operation classes, decimal exponents, arithmetic, and format-directed conversions. |
| §§5.5–5.7 | 2–3, 10–12, 14–15. Quiet sign operations, re-encoding, comparisons, version and classification predicates, flags, and quantum comparison. |
| §§5.8–5.12 | 8–9, 11. Integers, integral rounding, comparisons, total ordering, and text conversion. |
| §§6–8 | 2, 10, 12–13. Special operands, signs, exceptions, and alternate handling. |
| §9 | 16–19. Conforming extensions, math, modes, reductions, augmented operations, minimums and maximums, and payloads. |
| §§10–11 | 20–21. Expression evaluation, optimization, and reproducibility. |
| Annexes A–C | 21–23. Bibliography, debugging ideas, and operation lookup. |
Use Annex C as an operation index while writing each lesson's examples. The annexes are informative.