Really made me appreciate how unlikely it is to find an error. It feels as if it was planned just for me to find it. Just like the author studied cryptography and then decided to do some exercises to hone his skills, an unlikely journey towards a check.
A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
21–30 of 55 posts
Re: A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
#22"Now test if q̂ ≥ b or q̂·vₙ₋₂ > b·r̂ + uₙ₋₂; if so, decrease q̂ by 1, increase r̂ by vₙ₋₁, and repeat this test if r̂ That clearly a while loop. Lather, rinse, repeat.
Re: A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
#23EDIT : I recall fondly algorithm D... one of my first programming experiences in the 90s was trying to implement knuth's arithmetic algorithms for addition, substraction, etc. in 8086 asm. Got them right up until long multiplication (that one was a tremendous effort). Algorithm D was too formidable to even dare me attempt. Feel extremely happy to see people in 2026 looking at these algorithms closely.
Re: A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
#24Earlier quoted context omitted.
Unfortunately, one no longer gets physical checks, instead, one gets an account in The Bank of the Island of San Seriffe: https://www-cs-faculty.stanford.edu/~knuth/boss.html (unfortunately, I have yet to find another typo since getting my $2.88 for _Digital Typography_)
Close enough. If I ever got such a check it would be professionally framed and hung on my wall. As would most people reading this.
Re: A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
#25Re: A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
#26Earlier quoted context omitted.
Unfortunately, one no longer gets physical checks, instead, one gets an account in The Bank of the Island of San Seriffe: https://www-cs-faculty.stanford.edu/~knuth/boss.html (unfortunately, I have yet to find another typo since getting my $2.88 for _Digital Typography_)
Close enough. If I ever got such a check it would be professionally framed and hung on my wall. As would most people reading this.
⸻
1. I know at least one of these came from porting lesser-known utilities to VM/CMS. By that time, DEK already had adopted a practice of having his secretary print his emails and he’d hand-write a reply and you’d get it in the mail.
Re: A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
#27Earlier quoted context omitted.
Congratulations! Wow, you got a legendary $2.56 check....
Unfortunately, one no longer gets physical checks, instead, one gets an account in The Bank of the Island of San Seriffe: https://www-cs-faculty.stanford.edu/~knuth/boss.html (unfortunately, I have yet to find another typo since getting my $2.88 for _Digital Typography_)
Re: A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
#28This may very well be the most epic post in HN history. EDIT : I recall fondly algorithm D... one of my first programming experiences in the 90s was trying to implement knuth's arithmetic algorithms for addition, substraction, etc. in 8086 asm. Got them right up until long multiplication (that one was a tremendous effort). Algorithm D was too formidable to even dare me attempt. Feel extremely happy to see people in 2…
Re: A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
#29This bug is only in the English description of the algorithm, right? No bug in either the MIX or MMIX implementations?
Re: A decades-old bug in Knuth's long division (TAOCP Vol II, Algorithm 4.3.1D)
#30I used the same long division algorithm I was taught in 3rd grade, except in binary rather than base 10. Shift and subtract.
It was also the basis for implementing FDIV (floating point division) for those who did not have an x87 chip.
Nobody ever reported a bug in it.