by rna-mall · 3mo ago · 0 comments
"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̂ < b."
That clearly a while loop. Lather, rinse, repeat.
A loop would also call for additional run-time analysis. And Knuth changed Step D3, if it were a loop he wouldn't have had to. Additionally, there is no loop in Program D, his implementation of Algorithm D in MIX.
If you read the whole chapter and not just the statement itself (though I'd argue the statement is enough), it's very clearly two if's.
https://www.scribd.com/document/956350280/The-Art-of-Compute...
... on page 274 the MIX jumps in lines 058 and 060 to label 3H if the tests fail, where qhat is decremented again. I'm not at all a Mix expert, but where is the counter that the loop is only executed twice?
I think Knuth originally wanted a loop but obviously needed a proof that it terminates and does not waste too many iterations. That is why he mentions <= 2 in the text..
I mean, as you say, every implementation apart from LLVM understood the text as a loop.
Anyway, extremely nice work to correct Theorem B to <= 3!