8 comments

  • nk_kolja6 days ago
    I found a bug in Algorithm D, the long division algorithm in Knuth&#x27;s &quot;The Art of Computer Programming&quot;. It was discussed on HN a couple of times <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26562819">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26562819</a> as well as on other websites. I sent a letter to Knuth and received a check and an annotated reply. The updated Theorem B, which was unchanged since 1969 is now dated 2026.<p>While searching for vulnerable implementations I also found a &quot;bug&quot; in llvm, so I expanded a bit on that too.
    • jason_s1 day ago
      Congratulations! Wow, you got a legendary $2.56 check....
      • WillAdams3 hours ago
        Unfortunately, one no longer gets physical checks, instead, one gets an account in The Bank of the Island of San Seriffe:<p><a href="https:&#x2F;&#x2F;www-cs-faculty.stanford.edu&#x2F;~knuth&#x2F;boss.html" rel="nofollow">https:&#x2F;&#x2F;www-cs-faculty.stanford.edu&#x2F;~knuth&#x2F;boss.html</a><p>(unfortunately, I have yet to find another typo since getting my $2.88 for _Digital Typography_)
        • bluGill40 minutes ago
          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.
        • malisper2 hours ago
          You still get a physical piece of paper that looks like a check; it&#x27;s just not a valid check.
          • nk_kolja2 hours ago
            It can still be cashed in, though not in any bank, you need to contact Knuth beforehand.<p>For me it will stay framed on the wall.
            • WillAdams1 hour ago
              I wonder if one can do the reverse? Turn in a physical check and get an account?
      • warmwaffles3 hours ago
        Hopefully framed it and put it on the wall.
    • AndruLuvisi1 hour ago
      Wow, congratulations on finding this most epic bug!
  • vjerancrnjak8 minutes ago
    Great find and write up. This year if I remember correctly 40+ people got the check, ~1000 have an account at the bank. I got mine this year, an exercise I revisit every few years since 2012 to learn a new programming lang or approach had a newer update that made it have 2 offbyone errors.<p>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.
  • rna-mall5 minutes ago
    Nice work! I don&#x27;t find all implementations using &quot;while&quot; or &quot;goto loop&quot; surprising though.<p>&quot;Now test if q̂ ≥ b or q̂·vₙ₋₂ &gt; b·r̂ + uₙ₋₂; if so, decrease q̂ by 1, increase r̂ by vₙ₋₁, and repeat this test if r̂ &lt; b.&quot;<p>That clearly a while loop. Lather, rinse, repeat.
  • hirvi7434 minutes ago
    That is so cool. Exceptional work, friend.<p>That makes this thread a bit more interesting now.<p><a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;60479571&#x2F;is-there-a-bug-in-algorithm-4-3-1d-of-knuths-taocp" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;60479571&#x2F;is-there-a-bug-...</a>
  • globular-toast2 hours ago
    &gt; &quot;I&#x27;m especially glad to have this correction, because I think the readers of TAOCP Vol 2 look at Algorithm 4.3.1 D more than any other algorithm!&quot;<p>If you look at the fore edge of my copy of vol 2 will see a noticeably grubby line. Open the book at that page and you do indeed arrive at Algorithm D!<p>I&#x27;ve implemented multiple-precision arithmetic at least a couple of times. I&#x27;m tempted to dig up an old project I haven&#x27;t touched for over a decade and make the correction...
  • ginko3 hours ago
    The typesetting of this looks very broken on firefox with extreme gaps between lines of text. Seems to render fine on chromium.
    • Retr0id2 hours ago
      It renders fine for me, but I&#x27;ve also had the &quot;extreme gaps between lines&quot; thing happen before on Firefox, and in my case it was caused by a bad font fallback - I forget the precise details but I think it had something to do with having Arabic fonts installed, which were erroneously taking preference for certain non-arabic glyphs. (Check the Fonts tab in dev tools)
    • nk_kolja2 hours ago
      Thank you for letting me now, but I cannot replicate the issue on Firefox. There are some issues with math and the animations not breaking on mobile, which I am working on repairing. (fixed)<p>EDIT: I have added a different fallback font so it should work on your Firefox now.
    • voakbasda1 hour ago
      I believe this is a missing font issue, whereupon Firefox chooses very poor substitutes. I ran into this recently on one of my machines and solved it by installing the Microsoft fonts package (or possibly another one… I can’t remember now exactly which one did the trick).
      • ginko50 minutes ago
        Right, missing fonts could be the issue on my end.
    • metalliqaz2 hours ago
      I use firefox and it renders approximately the same as Chrome for me.<p>Assuming OP didn&#x27;t patch something, you may have a misbehaving extension.