logoalt Hacker News

rna-mallyesterday at 3:56 PM1 replyview on HN

Nice work! I don't find all implementations using "while" or "goto loop" surprising though.

"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.


Replies

nk_koljayesterday at 7:17 PM

I beg to differ.

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.

show 1 reply