The unrounded form of , , is the integer value of concatenated
with two more bits:
first, the “½ bit” from the binary representation of (the bit representing ; if ; or equivalently, ); and second,
a “sticky bit” that is 1 if any bits beyond the ½ bit were 1.
These are all equivalent definitions, using the convention that a boolean condition is 1 for true, 0 for false:
继续阅读全文
为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。
AI 摘要This article presents fast floating-point printing and parsing algorithms built on a new primitive called fast unrounded scaling, which approximates scaling by powers of ten, often in a single 64-bit multiplication. These simple algorithms reportedly outperform all prior known methods, including Dragon4, Grisu3, Ryū, Schubfach, and Dragonbox, and the author plans to include a Go implementation in Go 1.27. The post walks through the necessary concepts (fixed-point and floating-point numbers, unrounded numbers) and outlines implementations for fixed-width and shortest-width printing as well as decimal parsing.
AI 摘要This article is a reply to Donald Knuth's 1989 paper on proving the correctness of a program that converts 16-bit fixed-point binary fractions to their shortest accurate decimal representations, written in honor of Knuth's 88th birthday. The author presents what they argue is a better proof of Knuth's program P2 by starting with a simpler program that has a trivial direct correctness proof—implemented in the APL-like Ivy language—and then transforming it into P2 step by step, proving each transformation correct. The post also explores alternative solutions and concludes with reflections on how language and notation shape programs and proofs.
AI 摘要The article introduces the 'Floating Point Formatting' blog series, which began in 2011 and continued with new posts in 2026. It lists four posts covering topics such as floating-point to decimal conversion, a proof inspired by Knuth's fixed-point printer, simple and fast floating-point printing and parsing, and a proof of fast unrounded scaling verified with Ivy.
AI 摘要The article describes 'differential coverage', a debugging technique that compares the code coverage profile of a failing test with those of passing tests to isolate code blocks unique to the failing case. Demonstrating in Go, the author diffs two coverage profiles and views the result with go tool cover -html, successfully narrowing an injected bug down to 10 lines among over 15,000. While not foolproof (e.g., data-dependent bugs or insensitive tests can evade it), the technique is cheap to compute and can save considerable debugging time.
AI 摘要The article traces the history of debugging with binary search, from bisecting data (such as finding one bad punched card among a thousand) to bisecting version history, which was popularized by tools like git bisect that automatically pinpoint the commit that introduced a bug. It then introduces a new trick for debugging in a different dimension: hash-based bisecting of program locations, which selectively enables or disables subsets of program lines, call stacks, or code sequences to identify exactly which code causes a failure. Illustrated with a Go toolchain example, this technique is presented as a 'magic wand' for debugging large, opaque test failures in unfamiliar code bases, compilers, and runtimes.